Searched hist:287556 (Results 1 - 1 of 1) sorted by relevance

/freebsd-11.0-release/lib/libthr/thread/
H A Dthr_once.cdiff 287556 Tue Sep 08 08:45:54 MDT 2015 kib In the pthread_once(), if the initializer has already run, then the
calling thread is supposed to see accesses issued by the initializer.
This means that the read of the once_control->state variable should
have an acquire semantic. Use atomic_thread_fence_acq() when the
value read is ONCE_DONE, instead of straightforward atomic_load_acq(),
to only put a barrier when needed (*).

On the other hand, the updates of the once_control->state with the
intermediate progress state do not need to synchronize with other
state accesses, remove _acq suffix.

Reviewed by: alc (previous version)
Suggested by: alc (*)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

Completed in 48 milliseconds