Skip to content

Commit

Permalink
lock mutex of the receiver, not always the global var
Browse files Browse the repository at this point in the history
  • Loading branch information
jrick committed Jun 13, 2024
1 parent 65751e3 commit dea0a10
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crypto/rand/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ func init() {
}

func (p *lockingPRNG) Read(s []byte) (n int, err error) {
globalRand.mu.Lock()
defer globalRand.mu.Unlock()
p.mu.Lock()
defer p.mu.Unlock()

return p.PRNG.Read(s)
}
Expand Down

0 comments on commit dea0a10

Please sign in to comment.