pthread_once man page on HP-UX

Man page or keyword search:  
man Server   10987 pages
apropos Keyword Search (all sections)
Output format
HP-UX logo
[printable version]

pthread_once(3T)					      pthread_once(3T)

NAME
       pthread_once() - call an initialization routine only once

SYNOPSIS

   Parameters
       once_control   Pointer  to  the once-control object associated with the
		      one-time initialization function

       init_routine   The one-time initialization routine.   This  routine  is
		      called  only  once, regardless of the number of times it
		      and its associated once_control are passed to

DESCRIPTION
       The function guarantees that is only called one time in an application.
       This function will use the once_control object to determine if has pre‐
       viously been called via

       The first time is called with once_control and causes to be called with
       no  arguments.  Subsequent calls to with the same once_control will not
       cause to be called again.  When returns, the caller is guaranteed  that
       has been called (either just now or via a previous call).

       The  macro is used to statically initialize a once control block.  This
       initialization must be done before calling

       is not a cancellation point.  However, the caller  supplied  may	 be  a
       cancellation point.  If the thread executing is canceled, the once_con‐
       trol argument will be set to a state which indicates that has not  been
       called  yet  (see  pthread_cancel(3T)).	 The next time the function is
       called with once_control, the function will be called.

       The behavior of is undefined  if	 once_control  has  automatic  storage
       duration or is not initialized by

RETURN VALUE
       returns returns the following values:

	      Successful completion.

	      Failure.
		     An	 error number is returned to indicate the error.  (The
		     variable is not set.)

ERRORS
       The following error value is returned by if the corresponding condition
       is detected.

       Either	      once_control or init_routine is invalid.

EXAMPLES
       Some modules are designed for dynamic initialization, i.e., global ini‐
       tialization is performed when the  first	 function  of  the  module  is
       invoked.	  In  a single-threaded program, this is generally implemented
       as follows:

	      (Rest of the code after initialization.)

       For a multithreaded process, a simple initialization flag is not suffi‐
       cient;  the  flag  must	be  protected against modification by multiple
       threads.	 Consequently, this flag has to be protected by a  mutex  that
       has  to	be  initialized only once, and so on.  A multithreaded program
       should use initialization similar to:

	      (Rest of the code after initialization.)

AUTHOR
       was derived from the IEEE POSIX P1003.1c standard.

SEE ALSO
       pthread_create(3T).

STANDARDS CONFORMANCE
				Pthread Library		      pthread_once(3T)
[top]

List of man pages available for HP-UX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net