#include <pthread.h> pthread_once_t once_control = PTHREAD_ONCE_INIT; int pthread_once( pthread_once_t *once_control, void (*init_routine)(void) );
NONE
The pthread_once
routine is used to provide controlled initialization
of variables. The first call to pthread_once
by any thread with the
same once_control
will result in the init_routine
being
invoked with no arguments. Subsequent calls to pthread_once
with
the same once_control
will have no effect.
The init_routine
is guaranteed to have run to completion when
this routine returns to the caller.
The behavior of pthread_once
is undefined if once_control
is automatic storage (i.e. on a task stack) or is not initialized using
PTHREAD_ONCE_INIT
.
Copyright © 1988-2008 OAR Corporation