rlib
Convenience library for useful things
Loading...
Searching...
No Matches
ROnce Struct Reference

One-shot initialisation guard. More...

#include <rlib/concurrency/rthreads.h>

Data Fields

rauint state
 
rpointer ret
 

Detailed Description

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.

Field Documentation

◆ ret

rpointer ROnce::ret

Value returned by the init function.

◆ state

rauint ROnce::state

Current ROnceState (atomic).


The documentation for this struct was generated from the following file: