diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-11-29 06:23:27 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-12-04 10:53:39 +0100 |
commit | 6c2b8a4b35536a5f99ba1ef91139485b011dafc1 (patch) | |
tree | b1ab330104094ec83051c932c4d5cb9e653a4568 /cpukit/score/src/once.c | |
parent | ada/sp09: Fix timer server test case (diff) | |
download | rtems-6c2b8a4b35536a5f99ba1ef91139485b011dafc1.tar.bz2 |
score: Use self-contained API mutex
Use a self-contained recursive mutex for API_Mutex_Control. The API
mutexes are protected against asynchronous thread cancellation.
Add dedicated mutexes for libatomic and TOD.
Close #2629.
Close #2630.
Diffstat (limited to 'cpukit/score/src/once.c')
-rw-r--r-- | cpukit/score/src/once.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/cpukit/score/src/once.c b/cpukit/score/src/once.c index 427659e173..5237c11878 100644 --- a/cpukit/score/src/once.c +++ b/cpukit/score/src/once.c @@ -54,3 +54,15 @@ int _Once( unsigned char *once_state, void ( *init_routine )( void ) ) return eno; } + +static API_Mutex_Control _Once_Mutex = API_MUTEX_INITIALIZER( "_Once" ); + +void _Once_Lock( void ) +{ + _API_Mutex_Lock( &_Once_Mutex ); +} + +void _Once_Unlock( void ) +{ + _API_Mutex_Unlock( &_Once_Mutex ); +} |