Singletons features / single-shot execution. More...
Singletons features / single-shot execution.
Definition in file pthread_once.h.
Go to the source code of this file.
Data Structures | |
struct | pthread_once_t |
Datatype to supply to pthread_once(). More... | |
#define | PTHREAD_ONCE_INIT { 1, 0 } |
Initialization for pthread_once_t. | |
int | pthread_once (pthread_once_t *once_control, void(*init_routine)(void)) |
Helper function that ensures that init_routine is called at once. | |
#define PTHREAD_ONCE_INIT { 1, 0 } |
Initialization for pthread_once_t.
pthread_once_t variables are declared as initialized, but the init function is not yet executed.
Definition at line 40 of file pthread_once.h.
int pthread_once | ( | pthread_once_t * | once_control, |
void(*)(void) | init_routine | ||
) |
Helper function that ensures that init_routine
is called at once.
Calling pthread_once() changes once_control
. For the same once_control
the supplied init_routine
won't get called again, unless once_control
is reset to PTHREAD_ONCE_INIT or zeroed out.
[in,out] | once_control | Flag to ensure that the init_routine is called only once. |
[in] | init_routine | Function to call if once_control was not used, yet. |