pthread_once()

dynamic package initialization 

Function


SYNOPSIS

#include <pthread.h>

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

pthread_once_t once_control = PTHREAD_ONCE_INIT


DESCRIPTION

The first call to pthread_once() by any thread in a process, with a given once_control, calls the init_routine with no arguments. Subsequent calls of pthread_once() with the same once_control do not call the init_routine On return from pthread_once, init_routine has completed. The once_control parameter determines whether the associated initialization routine has been called.

The pthread_once() function is not a cancellation point. However, if init_routine is a cancellation point and is canceled, the effect on once_control is as if pthread_once() was never called.

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


PARAMETERS

init_routine 

Specifies an initialize routine to be run.

once_control 

Determines whether the associated initialization routine has been called.


RETURN VALUES

On success, pthread_once() returns 0. On error, one of the following values is returned:

EINVAL 

Either once_control or init_routine is invalid.


CONFORMANCE

UNIX 03.


MULTITHREAD SAFETY LEVEL

MT-safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


PTC MKS Toolkit 10.5 Documentation Build 40.