You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prior to this patch, the Go race detector was complaining about racy
concurrent accesses to `serverStateUsingChannels.server`, via
`(*serverStateUsingChannels) getServer()` and `(*channelOrchestrator)
startControlledServer()`.
These racy accesses happened to be safe because the writes and reads
to that field were correctly ordered around updates to an atomic
bool (the `started` field). However, the race detector is not
sufficiently sophisticated to detect this ordering and satisfy itself
that the state transition can only happen once.
In order to silence the race detector (with no change in correctness),
this patch replaces the atomic bool by a mutex, whose access semantics
are properly understood by the race detector.
This change incidentally makes the code slightly easier to read and
understand.
Co-authored-by: Lidor Carmel <[email protected]>
0 commit comments