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/score/src/coremutexsurrender.c | |
parent | posix: Delete POSIX_Mutex_Protocol::process_shared (diff) | |
download | rtems-5a598ac99b0de720a04afc5e2ac6764117589b90.tar.bz2 |
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 '')
-rw-r--r-- | cpukit/score/src/coremutexsurrender.c | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/cpukit/score/src/coremutexsurrender.c b/cpukit/score/src/coremutexsurrender.c index 6047409085..2d976e0c22 100644 --- a/cpukit/score/src/coremutexsurrender.c +++ b/cpukit/score/src/coremutexsurrender.c @@ -34,18 +34,12 @@ Status_Control _CORE_mutex_Surrender( holder = the_mutex->holder; /* - * The following code allows a thread (or ISR) other than the thread - * which acquired the mutex to release that mutex. This is only - * allowed when the mutex in quetion is FIFO or simple Priority - * discipline. But Priority Ceiling or Priority Inheritance mutexes - * must be released by the thread which acquired them. + * Priority Ceiling or Priority Inheritance mutexes must be released by the + * thread which acquired them. */ - - if ( the_mutex->Attributes.only_owner_release ) { - if ( !_Thread_Is_executing( holder ) ) { - _ISR_lock_ISR_enable( &queue_context->Lock_context ); - return STATUS_NOT_OWNER; - } + if ( !_Thread_Is_executing( holder ) ) { + _ISR_lock_ISR_enable( &queue_context->Lock_context ); + return STATUS_NOT_OWNER; } _CORE_mutex_Acquire_critical( the_mutex, queue_context ); @@ -88,10 +82,7 @@ Status_Control _CORE_mutex_Surrender( * Formally release the mutex before possibly transferring it to a * blocked thread. */ - if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) || - _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) { - holder->resource_count--; - } + holder->resource_count--; the_mutex->holder = NULL; /* @@ -101,7 +92,7 @@ Status_Control _CORE_mutex_Surrender( if ( ( the_thread = _Thread_queue_First_locked( &the_mutex->Wait_queue, - the_mutex->operations + CORE_MUTEX_TQ_OPERATIONS ) ) ) { @@ -118,7 +109,7 @@ Status_Control _CORE_mutex_Surrender( */ unblock = _Thread_queue_Extract_locked( &the_mutex->Wait_queue.Queue, - the_mutex->operations, + CORE_MUTEX_TQ_OPERATIONS, the_thread, queue_context ); @@ -128,9 +119,6 @@ Status_Control _CORE_mutex_Surrender( #endif { switch ( the_mutex->Attributes.discipline ) { - case CORE_MUTEX_DISCIPLINES_FIFO: - case CORE_MUTEX_DISCIPLINES_PRIORITY: - break; case CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT: the_thread->resource_count++; _Thread_queue_Boost_priority( &the_mutex->Wait_queue.Queue, the_thread ); |