Standard C Library Functions pthreadonce(3C)
NAME
pthreadonce - initialize dynamic package
SYNOPSIS
cc -mt [ flag... ] file... -lpthread [ library... ]
#include
pthreadoncet oncecontrol = PTHREADONCEINIT;
int pthreadonce(pthreadoncet *oncecontrol,
void (*initroutine)(void));
DESCRIPTION
If any thread in a process with a oncecontrol parameter
makes a call to pthreadonce(), the first call will summon
the initroutine(), but subsequent calls will not. The
oncecontrol parameter determines whether the associated
initialization routine has been called. The initroutine()
is complete upon return of pthreadonce().
pthreadonce() is not a cancellation point; however, if the
function initroutine() is a cancellation point and is can-
celed, the effect on oncecontrol is the same as if
pthreadonce() had never been called.
The constant PTHREADONCEINIT is defined in the
header.
If oncecontrol has automatic storage duration or is not
initialized by PTHREADONCEINIT, the behavior of
pthreadonce() is undefined.
RETURN VALUES
Upon successful completion, pthreadonce() returns 0. Other-
wise, an error number is returned to indicate the error.
ERORS
EINVAL oncecontrol or initroutine is NUL.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
SunOS 5.11 Last change: 23 Mar 2005 1
Standard C Library Functions pthreadonce(3C)
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Standard
MT-Level MT-Safe
SEE ALSO
attributes(5), standards(5)
NOTES
Solaris threads do not offer this functionality.
SunOS 5.11 Last change: 23 Mar 2005 2
|