60 return (
Status)latchedInitState;
87 ENSURE(latchedInitState < 0);
88 return (
Status)latchedInitState;
#define COMPILER_FENCE
prevent the compiler from reordering loads or stores across this point.
static const ModuleInitState INITIALIZED
static ModuleInitState initState
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
intptr_t ModuleInitState
initialization state of a module (class, source file, etc.) must be initialized to zero (e...
i64 Status
Error handling system.
Status ModuleShutdown(volatile ModuleInitState *initState, void(*shutdown)())
calls a user-defined shutdown function if initState is "initialized".
bool cpu_CAS(volatile intptr_t *location, intptr_t expected, intptr_t newValue)
atomic "compare and swap".
Status ModuleInit(volatile ModuleInitState *initState, Status(*init)())
calls a user-defined init function if initState is zero.
static const ModuleInitState UNINITIALIZED
void cpu_Pause()
pause in spin-wait loops, as a performance optimisation.