dynamic package initialization
cc [options] -Kthread file
int pthread_once(pthread_once_t *once_control,
void (*init_routine) (void));
pthread_once_t once_control = PTHREAD_ONCE_INIT;
pthread_once performs dynamic library
initialization in a multithreaded process, thus aiding
in the reliable construction of multithreaded and
The first call to pthread_once by any thread in
a process, with a given once_control,
will call init_routine with no arguments.
Subsequent calls of pthread_once
with the same once_control will not call
On return from pthread_once,
it is guaranteed that init_routine
The once_control parameter is used to
determine whether the associated initialization
routine has been called.
The function pthread_once is not a cancellation point.
However, if init_routine is a cancellation point
and the calling thread is canceled in init_routine,
the effect on once_control is as if
pthread_once was never called.
The macro PTHREAD_ONCE_INIT is defined in the
The behavior of pthread_once is undefined if
once_control is not initialized by
The once_control parameter is a pointer to a value
that indicates whether init_routine has been called.
init_routine is a pointer to a library-exported
pthread_once returns zero on success.
Otherwise, an error number is returned and no signal is sent.
pthread_once returns the following value if the
corresponding condition is detected:
once_control is not a valid argument.
The Single UNIX Specification, Version 2; The Open Group.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004