NAME
pptthhrreeaaddoonnccee - dynamic package initialization
SYNOPSIS
##iinncclluuddee <
pthreadoncet oncecontrol = PTHREADONCEINIT; int pptthhrreeaaddoonnccee(pthreadoncet *oncecontrol, void (*initroutine)(void));> DESCRIPTION
The first call to pptthhrreeaaddoonnccee() by any thread in a process, with a given oncecontrol, will call the iinniittrroouuttiinnee() with no arguments. Subsequent calls to pptthhrreeaaddoonnccee() with the same oncecontrol will not call the iinniittrroouuttiinnee(). On return from pptthhrreeaaddoonnccee(), it is guaranteed that iinniittrroouuttiinnee() has completed. The oncecontrol parameter is used to determine whether the associated initialization routine has been called. The function pptthhrreeaaddoonnccee() is not a cancellation point. However, if iinniittrroouuttiinnee() is a cancellation point and is cancelled, the effect on oncecontrol is as if pptthhrreeaaddoonnccee() was never called. The constant PTHREADONCEINIT is defined by header. The behavior of pptthhrreeaaddoonnccee() is undefined if oncecontrol has automatic storage duration or is not initialized by PTHREADONCEINIT. RETURN VALUES
If successful, the pptthhrreeaaddoonnccee() function will return zero. Otherwise an error number will be returned to indicate the error. EERRRROORRSS None. STANDARDSpptthhrreeaaddoonnccee() conforms to ISO/IEC 9945-1:1996 (``POSIX.1'').
BSD April 4, 1996 BSD