pthread_once(3P) pthread_once(3P)
pthread_once - thread-safe initialization
#include <pthread.h>
int pthread_once(pthread_once_t *once, void (*init)(void));
The pthread_once() function ensures that the function init is called
exactly once for all callers using the once initialization variable.
This variable is initialized with the constant PTHREAD_ONCE_INIT. While
init is being executed all callers of pthread_once() will wait.
If a thread is cancelled while executing the init function [see
pthread_setcancelstate()], then pthread_once() will permit another thread
(possibly waiting) to make the call.
There are no errors for pthread_once.
pthread_setcancelstate(3P).
PPPPaaaaggggeeee 1111 [ Back ]
|