Calls a one-time initialization routine that can be executed by only one thread, once.
tis_once(
         once_control,
         init_routine );
 
Argument         Data Type               Access
once_control     opaque pthread_once_t   modify
init_routine     procedure               read
#includeint tis_once ( pthread_once_t *once_control, void (*init_routine) (void));
For example, a mutex or a context key must be created exactly once. In a threaded environment, calling tis_once ensures that the initialization is serialized across multiple threads.
The once_control variable must be statically initialized using the PTHREAD_ONCE_INIT macro or by zeroing out the entire structure.
The PTHREAD_ONCE_INIT macro is defined in the  
Note that it is often easier to simply lock a statically initialized
mutex, check a control flag, and perform necessary initialization
(in-line) rather than using tis_once. For example, code an init
routine beginning with the following basic logic:
 
0             Successful completion.
[EINVAL]      Invalid argument.
 
 pthread_once_t  once_control = PTHREAD_ONCE_INIT;
  init()
  {
   static pthread_mutex_t    mutex = PTHREAD_MUTEX_INIT;
   static int                flag = FALSE;
   tis_mutex_lock(&mutex);
   if(!flag)
     {
      flag = TRUE;
      /* initialize code */
     }
   tis_mutex_unlock(&mutex);
  }
Return Values
If an error occurs, this routine returns an integer indicating the
type of error. Possible return values are as follows:
 
Return        Description