HP-UX Reference (11i v1 00/12) - 3 Library Functions N-Z (vol 7)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/nan.3m
________________________________________________________________
___ ___
p
pthread_once(3T) pthread_once(3T)
(Pthread Library)
For a multithreaded process, a simple initialization flag is not sufficient; the flag must be protected against
modification by multiple threads. Consequently, this flag has to be protected by a mutex that has to be ini-
tialized only once, and so on. A multithreaded program should use initialization similar to:
static pthread_once_t once_control = PTHREAD_ONCE_INIT;
extern void initialize();
(void)pthread_once(&once_control, initialize);
Rest of the code after initialization.
AUTHOR
pthread_once() was derived from the IEEE POSIX P1003.1c standard.
SEE ALSO
pthread_create(3T).
STANDARDS CONFORMANCE
pthread_once()
: POSIX 1003.1c.
Section 3704 2 HP-UX Release 11i: December 2000
___
___