HomeFreeBSD

Fix race between first rand(3) calls with _once().

Description

Fix race between first rand(3) calls with _once().

Before this patch there was a chance for thread that called rand(3)
slightly later to see rand3_state already allocated, but not yet
initialized. While this API is not expected to be thread-safe, it
is not expected to crash. ztest on 64-thread system reproduced it
reliably for me.

Submitted by: avg@
MFC after: 1 month

Details

Provenance
mavAuthored on Jul 21 2021, 3:25 PM
Parents
rG2ae65d449fec: Revert "Fix race between first rand(3) calls."
Branches
Unknown
Tags
Unknown