|
rlib
Convenience library for useful things
|
One-shot initialisation guard. More...
#include <rlib/concurrency/rthreads.h>
Data Fields | |
| rauint | state |
| rpointer | ret |
One-shot initialisation guard.
Pass the same ROnce instance to every r_call_once call; the supplied init function is invoked at most once across all threads. Subsequent calls return the cached pointer the init function returned, on a fast path with no CAS.
Storage must be either zero-initialised (static / global) or explicitly seeded with R_ONCE_INIT before first use.
| rpointer ROnce::ret |
Value returned by the init function.
| rauint ROnce::state |
Current ROnceState (atomic).