diff options
Diffstat (limited to 'cpukit/score')
-rw-r--r-- | cpukit/score/src/once.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/cpukit/score/src/once.c b/cpukit/score/src/once.c index cf576e90ef..f3a29e5ec5 100644 --- a/cpukit/score/src/once.c +++ b/cpukit/score/src/once.c @@ -59,6 +59,22 @@ static Once_Control _Once_Information = { .State = RTEMS_CONDITION_VARIABLE_INITIALIZER( "_Once" ) }; +static Thread_Life_state _Once_Lock( void ) +{ + Thread_Life_state thread_life_state; + + thread_life_state = _Thread_Set_life_protection( THREAD_LIFE_PROTECTED ); + rtems_mutex_lock( &_Once_Information.Mutex ); + + return thread_life_state; +} + +static void _Once_Unlock( Thread_Life_state thread_life_state ) +{ + rtems_mutex_unlock( &_Once_Information.Mutex ); + _Thread_Set_life_protection( thread_life_state ); +} + int _Once( unsigned char *once_state, void ( *init_routine )( void ) ) { _Atomic_Fence( ATOMIC_ORDER_ACQUIRE ); @@ -90,19 +106,3 @@ int _Once( unsigned char *once_state, void ( *init_routine )( void ) ) return 0; } - -Thread_Life_state _Once_Lock( void ) -{ - Thread_Life_state thread_life_state; - - thread_life_state = _Thread_Set_life_protection( THREAD_LIFE_PROTECTED ); - rtems_mutex_lock( &_Once_Information.Mutex ); - - return thread_life_state; -} - -void _Once_Unlock( Thread_Life_state thread_life_state ) -{ - rtems_mutex_unlock( &_Once_Information.Mutex ); - _Thread_Set_life_protection( thread_life_state ); -} |