diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-27 08:02:03 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-30 16:16:23 +0200 |
commit | 5a598ac99b0de720a04afc5e2ac6764117589b90 (patch) | |
tree | 811d57df33c0f4fcc1cce61095cb5c0a33eadd7c /cpukit/posix/src/mutexunlock.c | |
parent | bbb3c5f3314abb1c29cf2e467175a114b28a787d (diff) |
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.
Diffstat (limited to 'cpukit/posix/src/mutexunlock.c')
-rw-r--r-- | cpukit/posix/src/mutexunlock.c | 21 |
1 files changed, 20 insertions, 1 deletions
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 ); } |