1 .TH PTHREAD_ONCE 3 LinuxThreads
4 pthread_once \- once-only initialization
9 pthread_once_t once_control = PTHREAD_ONCE_INIT;
11 int pthread_once(pthread_once_t *once_control, void (*init_routine) (void));
15 The purpose of !pthread_once! is to ensure that a piece of
16 initialization code is executed at most once. The |once_control|
17 argument points to a static or extern variable statically initialized
18 to !PTHREAD_ONCE_INIT!.
20 The first time !pthread_once! is called with a given |once_control|
21 argument, it calls |init_routine| with no argument and changes the
22 value of the |once_control| variable to record that initialization has
23 been performed. Subsequent calls to !pthread_once! with the same
24 !once_control! argument do nothing.
27 !pthread_once! always returns 0.
33 Xavier Leroy <Xavier.Leroy@inria.fr>