Code review comment for lp:~mfoord/juju-core/instancepoller-aggregate

Revision history for this message
Roger Peppe (rogpeppe) wrote :

LGTM with the fix below.

https://codereview.appspot.com/74900044/diff/40001/worker/instancepoller/aggregate_test.go
File worker/instancepoller/aggregate_test.go (right):

https://codereview.appspot.com/74900044/diff/40001/worker/instancepoller/aggregate_test.go#newcode57
worker/instancepoller/aggregate_test.go:57: i.counter =
atomic.AddInt32(&i.counter, 1)
ha ha, this is wrong, although it will work in the single-threaded case.
The reason AddInt32 takes a pointer is because it does the atomic
increment itself. By assigning to i.counter outside of that, we raise
the possibility that we might undo an add made by another concurrent
call to AddInt32.

just lose the "i.counter = " bit.

https://codereview.appspot.com/74900044/

« Back to merge proposal