RTEMS Logo

RTEMS 4.7.99.2 On-Line Library


Thread Manager pthread_once - Dynamic Package Initialization

PREV UP NEXT Bookshelf RTEMS POSIX API User's Guide

17.4.23: pthread_once - Dynamic Package Initialization

CALLING SEQUENCE:

#include <pthread.h>

pthread_once_t once_control = PTHREAD_ONCE_INIT;

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

STATUS CODES:

NONE

DESCRIPTION:

The pthread_once routine is used to provide controlled initialization of variables. The first call to pthread_once by any thread with the same once_control will result in the init_routine being invoked with no arguments. Subsequent calls to pthread_once with the same once_control will have no effect.

The init_routine is guaranteed to have run to completion when this routine returns to the caller.

NOTES:

The behavior of pthread_once is undefined if once_control is automatic storage (i.e. on a task stack) or is not initialized using PTHREAD_ONCE_INIT.


PREV UP NEXT Bookshelf RTEMS POSIX API User's Guide

Copyright © 1988-2004 OAR Corporation