commit | 36a0f65990e8bea90a188f1dcf4275009ab08821 | [log] [tgz] |
---|---|---|
author | Oliver, Jonathan <git@jonathanoliver.com> | Thu May 29 20:51:51 2014 -0600 |
committer | Oliver, Jonathan <git@jonathanoliver.com> | Thu May 29 20:51:51 2014 -0600 |
tree | 9588596e25778127f68ecbeb89c21629f2dcdd92 | |
parent | 3399e031e22b8614d135e4673da12f7e720c4c47 [diff] |
Consumer watches for race conditions.
diff --git a/example/main.go b/example/main.go index 0fed9f0..09e3ffc 100644 --- a/example/main.go +++ b/example/main.go
@@ -79,7 +79,10 @@ func (this SampleConsumer) Consume(lower, upper int64) { for lower <= upper { - if ringBuffer[lower&BufferMask] > 0 { + message := ringBuffer[lower&BufferMask] + if message != lower { + fmt.Println("Race condition", message, lower) + panic("Race condition") } lower++ }