From 5a598ac99b0de720a04afc5e2ac6764117589b90 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 27 May 2016 08:02:03 +0200 Subject: score: Add CORE mutex variants Add CORE_recursive_mutex_Control and CORE_ceiling_mutex_Control to avoid the run-time evaluation of attributes to figure out how a particular mutex methods should behave. Start with the no protocol variants. This eliminates the CORE_MUTEX_DISCIPLINES_FIFO and CORE_MUTEX_DISCIPLINES_PRIORITY disciplines. --- cpukit/posix/src/mutexunlock.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'cpukit/posix/src/mutexunlock.c') diff --git a/cpukit/posix/src/mutexunlock.c b/cpukit/posix/src/mutexunlock.c index 1c3f2d83f4..b0ca33d154 100644 --- a/cpukit/posix/src/mutexunlock.c +++ b/cpukit/posix/src/mutexunlock.c @@ -33,6 +33,7 @@ int pthread_mutex_unlock( { POSIX_Mutex_Control *the_mutex; Thread_queue_Context queue_context; + Thread_Control *executing; Status_Control status; the_mutex = _POSIX_Mutex_Get( mutex, &queue_context ); @@ -41,6 +42,24 @@ int pthread_mutex_unlock( return EINVAL; } - status = _CORE_mutex_Surrender( &the_mutex->Mutex, &queue_context ); + executing = _Thread_Executing; + + switch ( the_mutex->protocol ) { + case POSIX_MUTEX_NO_PROTOCOL: + status = _CORE_recursive_mutex_Surrender_no_protocol( + &the_mutex->Mutex.Recursive, + POSIX_MUTEX_NO_PROTOCOL_TQ_OPERATIONS, + executing, + &queue_context + ); + break; + default: + status = _CORE_mutex_Surrender( + &the_mutex->Mutex.Recursive.Mutex, + &queue_context + ); + break; + } + return _POSIX_Get_error( status ); } -- cgit v1.2.3