Make the readiness value a uint32 and read/write it with the atomic
package functions LoadUint32 and StoreUint32, instead of unprotected
access to a boolean.
The health readiness value is read and written from different goroutines
mostly. This was explicitly done without locking as the readiness value
was a single bit and nothing that needed to be synchronised. That's
still bad. At least, it should be an atomic - no data should be
read/written concurrently without an atomic or a mutex or more.
Add a test case that fails the race detector if readiness is not
properly protected.
Make the readiness value a uint32 and read/write it with the
atomic
package functionsLoadUint32
andStoreUint32
, instead of unprotected access to a boolean.The health readiness value is read and written from different goroutines mostly. This was explicitly done without locking as the readiness value was a single bit and nothing that needed to be synchronised. That's still bad. At least, it should be an atomic - no data should be read/written concurrently without an atomic or a mutex or more.
Add a test case that fails the race detector if readiness is not properly protected.