*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->OpenBSD man pages -> pthread_once (3)              
Title
Content
Arch
Section
 

PTHREAD_ONCE(3)

Contents


NAME    [Toc]    [Back]

     pthread_once - dynamic package initialization

SYNOPSIS    [Toc]    [Back]

     #include <pthread.h>

     pthread_once_t once_control = PTHREAD_ONCE_INIT;

     int
     pthread_once(pthread_once_t       *once_control,        void
(*init_routine)(void));

DESCRIPTION    [Toc]    [Back]

     The first call to pthread_once() by any thread in a process,
with a given
     once_control, will call the  init_routine()  with  no  arguments.  Subsequent
     calls  to pthread_once() with the same once_control will not
call the
     init_routine().  On return from pthread_once(), it is  guaranteed that
     init_routine() has completed.  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 is cancelled, the
effect on
     once_control is as if pthread_once() was never called.

     The constant PTHREAD_ONCE_INIT is defined in the header file
<pthread.h>.

     The behavior of pthread_once() is undefined if  once_control
has automatic
     storage duration or is not initialized by PTHREAD_ONCE_INIT.

RETURN VALUES    [Toc]    [Back]

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

ERRORS    [Toc]    [Back]

     None.

STANDARDS    [Toc]    [Back]

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

OpenBSD     3.6                           April      4,      1996
[ Back ]
 Similar pages
Name OS Title
aio_sgi_init IRIX asynchronous I/O initialization
aio_init IRIX asynchronous I/O initialization
tset OpenBSD terminal initialization
reset OpenBSD terminal initialization
reset FreeBSD terminal initialization
tclxinit IRIX Extended Tcl initialization.
tset FreeBSD terminal initialization
tset Linux terminal initialization
dld.so HP-UX dynamic loader
dld.sl HP-UX dynamic loader
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service