The _Once() function for pthread_once() and rtems_gxx_once().
More...
The _Once() function for pthread_once() and rtems_gxx_once().
◆ _Once()
int _Once |
( |
unsigned char * |
once_state, |
|
|
void(*)(void) |
init_routine |
|
) |
| |
Reacts according to the state of once_state.
If once_state is ONCE_STATE_INIT, then the once state is set first to ONCE_STATE_RUNNING and after calling the init routine it is set to ONCE_STATE_COMPLETED. If once_state is ONCE_STATE_COMPLETED, nothing happens. If once_state is not either one, this method waits for the Once_Information_Mutex.
- Parameters
-
once_state | The once state. |
init_routine | The initialization routine called if once_state is ONCE_STATE_INIT. |
- Returns
- This method always returns zero upon termination.
◆ _Once_Lock()
Locks the Once_Information_Mutex and returns the thread life state.
- Returns
- The thread life state (THREAD_LIFE_PROTECTED).
◆ _Once_Unlock()
Unlocks the Once_Information_Mutex and sets the thread life protection to thread_life_state.
- Parameters
-
thread_life_state | The thread life state to set the thread life protection to. |