pthread_once.h¶
Singletons features / single-shot execution.
Note
Do not include this header file directly, but pthread.h.
-
PTHREAD_ONCE_INIT¶ Initialization for pthread_once_t.
1
0A zeroed out pthread_once_t is initialized.
-
int
pthread_once_t¶ Datatype to supply to
pthread_once.h::pthread_once().
-
int
pthread_once(pthread_once.h::pthread_once_t* once_control, void(*)(void) init_routine)¶ Helper function that ensures that
init_routineis called at once.Calling
pthread_once.h::pthread_once()changesonce_control. For the sameonce_controlthe suppliedinit_routinewon’t get called again, unlessonce_controlis reset topthread_once.h::PTHREAD_ONCE_INITor zeroed out.Parameters
once_control: Flag to ensure that the init_routineis called only once.init_routine: Function to call if once_controlwas not used, yet.Return values
- 0, this invocation cannot fail.