NAME | SYNOPSIS | API RESTRICTIONS | DESCRIPTION | RETURN VALUE | ATTRIBUTES
#include <pthread.h> pthread_once_t once_control = PTHREAD_ONCE_INIT;int pthread_once(pthread_once_t *once_control, void (*init_routine)void);
The function or functions documented here may not be used safely in all application contexts with all APIs provided in the ChorusOS 5.0 product.
See API(5FEA) for details.
The pthread_once() function is a synchronization tool used for dynamic initialization of library packages that are invoked concurrently from multiple threads. The first call to pthread_once() by any thread in an actor, with a once_control provided, will invoke the init_routine() function with no arguments. Subsequent calls to pthread_once() will not call init_routine(). On return from pthread_once(), it is guaranteed that init_routine() has completed. The variable referenced by the once_control argument is used to determine whether the associated initialization routine has been called.
If once_control has automatic storage duration or was not initialized using PTHREAD_ONCE_INIT, the behavior of pthread_once() is undefined.
The pthread_once() function always returns zero.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
NAME | SYNOPSIS | API RESTRICTIONS | DESCRIPTION | RETURN VALUE | ATTRIBUTES