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.
LGTM with the fix below.
https:/ /codereview. appspot. com/74900044/ diff/40001/ worker/ instancepoller/ aggregate_ test.go instancepoller/ aggregate_ test.go (right):
File worker/
https:/ /codereview. appspot. com/74900044/ diff/40001/ worker/ instancepoller/ aggregate_ test.go# newcode57 instancepoller/ aggregate_ test.go: 57: i.counter = AddInt32( &i.counter, 1)
worker/
atomic.
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/