RTEMS: Once Functions.

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Files | Functions
Once Functions.
Internal » SuperCore

The _Once() function for pthread_once() and rtems_gxx_once(). More...

## Files
file | onceimpl.h
| Once API.

## Functions
int | _Once (unsigned char *once_state, void(*init_routine)(void))
| Reacts according to the state of once_state.
Thread_Life_state | _Once_Lock (void)
| Locks the Once_Information_Mutex and returns the thread life state.
void | _Once_Unlock (Thread_Life_state thread_life_state)
| Unlocks the Once_Information_Mutex and sets the thread life protection to thread_life_state.

## Detailed Description

The _Once() function for pthread_once() and rtems_gxx_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_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()

Thread_Life_state _Once_Lock | ( | void |  | ) |

Locks the Once_Information_Mutex and returns the thread life state.

Returns
  The thread life state (THREAD_LIFE_PROTECTED).

## ◆ _Once_Unlock()

void _Once_Unlock | ( | Thread_Life_state | thread_life_state | ) |

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.