veyron/lib/stats: Fix race due to non-pointer receiver
The previous code had a race condition because the Integer object was
access with both pointer and non-pointer receivers without higher lever
synchronization. The mutex inside Integer doesn't matter: the access to 'i'
itself caused the race, not the access to i.value.
51 func (i Integer) Value() interface{} {
52 i.mu.RLock()
53 defer i.mu.RUnlock()
54 return i.value
55 }
The solution is to always use a pointer receiver.
Change-Id: Ieb13032afdaa63e2418f1468d6d5b7a803f00c76
Context: https://code.google.com/p/envyor/issues/detail?id=316
3 files changed