This race is benign, but it still trips up the race detector, so turn
this into an atomic read.
Fixes #52739.
Change-Id: Ib53362286b456513c8c69d6d2d73c6c90ec095f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/404475
Auto-Submit: Jason Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Jason Donenfeld <Jason@zx2c4.com>
}
if atomic.LoadUint32(&r.used) != 2 {
r.mu.Lock()
- if r.used != 2 {
+ if atomic.LoadUint32(&r.used) != 2 {
f, err := os.Open(urandomDevice)
if err != nil {
r.mu.Unlock()