RTEMS 6.1-rc2
Loading...
Searching...
No Matches
Files | Functions
Execute Once Support

This group contains the implementation to execute a routine only once. More...

Files

file  onceimpl.h
 This header file provides the interfaces of the Execute Once Support.
 
file  once.c
 This source file contains the implementation of _Once(), _Once_Lock(), and _Once_Unlock().
 

Functions

int _Once (unsigned char *once_state, void(*init_routine)(void))
 Reacts according to the state of once_state.
 

Detailed Description

This group contains the implementation to execute a routine only once.

Function Documentation

◆ _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_stateThe once state.
init_routineThe initialization routine called if once_state is ONCE_STATE_INIT.
Returns
This method always returns zero upon termination.