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.
#define | PTHREAD_ONCE_INIT 0 |
Initialization for pthread_once_t. More... | |
typedef volatile int | pthread_once_t |
Datatype to supply to pthread_once(). | |
int | pthread_once (pthread_once_t *once_control, void(*init_routine)(void)) |
Helper function that ensures that init_routine is called at once. More... | |
#define PTHREAD_ONCE_INIT 0 |
Initialization for pthread_once_t.
A zeroed out pthread_once_t is initialized.
Definition at line 34 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. |