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/libatomic.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/libatomic.c')
-rw-r--r-- | cpukit/score/src/libatomic.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/cpukit/score/src/libatomic.c b/cpukit/score/src/libatomic.c index bfa3e6fb25..364e38f1b3 100644 --- a/cpukit/score/src/libatomic.c +++ b/cpukit/score/src/libatomic.c @@ -59,21 +59,19 @@ void _Libatomic_Protect_end( void *ptr, __uint32_t isr_level ) _ISR_Local_enable( isr_level ); } -/* - * FIXME: The once lock should be only a temporary solution. We need a - * dedicated internal mutex for this. - */ +static API_Mutex_Control _Libatomic_Mutex = + API_MUTEX_INITIALIZER( "_Libatomic" ); void _Libatomic_Lock_n( void *ptr, __size_t n ) { (void) ptr; (void) n; - _Once_Lock(); + _API_Mutex_Lock( &_Libatomic_Mutex ); } void _Libatomic_Unlock_n( void *ptr, __size_t n ) { (void) ptr; (void) n; - _Once_Unlock(); + _API_Mutex_Unlock( &_Libatomic_Mutex ); } |