The first call to
by any thread in a process, with a given once_control,
will call the
with no arguments. Subsequent calls to
pthread_once() with the same
once_control will not call the
init_routine(). On return from
pthread_once(), it is guaranteed that
init_routine() has completed. The
once_control parameter is used to determine whether
the associated initialization routine has been called.
is not a cancellation point. However, if
is a cancellation point and is cancelled, the effect on
once_control is as if
pthread_once() was never called.
PTHREAD_ONCE_INIT is defined
in the header file
The behavior of
is undefined if once_control has automatic storage
duration or is not initialized by
If successful, the
will return zero. Otherwise an error number will be returned to indicate the
pthread_once() conforms to
ISO/IEC 9945-1:1996 (“POSIX.1”).