MyWebUniversity.com Home Page
 



Darwin Mac OS X man pages main menu
PTHREADONCE(3)          BSD Library Functions Manual          PTHREADONCE(3)

NAME
     pthreadonce -- dynamic package initialization

SYNOPSIS
     ##include <>

     pthreadoncet oncecontrol = PTHREADONCEINIT;

     int
     pthreadonce(pthreadoncet *oncecontrol, void (*initroutine)(void));

DESCRIPTION
     The first call to pthreadonce() by any thread in a process, with a given
     oncecontrol, will call the initroutine() with no arguments.  Subsequent
     calls to pthreadonce() with the same oncecontrol will not call the
     initroutine().  On return from pthreadonce(), it is guaranteed that
     initroutine() has completed.  The oncecontrol parameter is used to
     determine whether the associated initialization routine has been called.

     The function pthreadonce() is not a cancellation point.  However, if
     initroutine() is a cancellation point and is cancelled, the effect on
     oncecontrol is as if pthreadonce() was never called.

     The constant PTHREADONCEINIT is defined by header .

     The behavior of pthreadonce() is undefined if oncecontrol has automatic
     storage duration or is not initialized by PTHREADONCEINIT.

RETURN VALUES
     If successful,  the pthreadonce() function will return zero.  Otherwise
     an error number will be returned to indicate the error.

ERORS
     None.

STANDARDS
     pthreadonce() conforms to ISO/IEC 9945-1:1996 (``POSIX.1'').

BSD                              April 4, 1996                             BSD
Darwin Mac OS X man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™