From 6c2b8a4b35536a5f99ba1ef91139485b011dafc1 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 29 Nov 2017 06:23:27 +0100 Subject: 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. --- cpukit/score/src/libatomic.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'cpukit/score/src/libatomic.c') 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 ); } -- cgit v1.2.3