37OFOnce(OFOnceControl *control,
void (*
function)(
void))
39#if !defined(OF_HAVE_THREADS)
44#elif defined(OF_HAVE_PTHREADS)
45 pthread_once(control,
function);
46#elif defined(OF_HAVE_ATOMIC_OPS)
51 if (OFAtomicIntCompareAndSwap(control, 0, 1)) {
52 OFAcquireMemoryBarrier();
55 OFAtomicIntIncrease(control);
57 OFReleaseMemoryBarrier();
61#elif defined(OF_AMIGAOS)
76 while (*control == 1) {
89# error No OFOnce available
void OFOnce(OFOnceControl *control, OFOnceFunction function)
Executes the specified function exactly once in the application's lifetime, even in a multi-threaded ...
Definition OFOnce.m:37
static OF_INLINE void OFYieldThread(void)
Yield the current thread, indicating to the OS that another thread should execute instead.
Definition OFPlainMutex.h:171