summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/coremutex.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1998-02-20 20:23:57 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1998-02-20 20:23:57 +0000
commit9b39bab01d9c5bf67e6a5736d18dc40e48971c53 (patch)
tree75491a13bbc29f1c2dbf5f729134642f4adbb94d /cpukit/score/src/coremutex.c
parentupdated (diff)
downloadrtems-9b39bab01d9c5bf67e6a5736d18dc40e48971c53.tar.bz2
Modified to make it possible for an ISR to return a mutex which did
not use priority ceiling or priority inheritance protocols.
Diffstat (limited to 'cpukit/score/src/coremutex.c')
-rw-r--r--cpukit/score/src/coremutex.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/cpukit/score/src/coremutex.c b/cpukit/score/src/coremutex.c
index 0f289dfe88..dac5a5172b 100644
--- a/cpukit/score/src/coremutex.c
+++ b/cpukit/score/src/coremutex.c
@@ -240,9 +240,27 @@ CORE_mutex_Status _CORE_mutex_Surrender(
executing = _Thread_Executing;
+ /*
+ * 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.
+ */
+
if ( !_Objects_Are_ids_equal(
- _Thread_Executing->Object.id, the_mutex->holder_id ) )
- return( CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE );
+ _Thread_Executing->Object.id, the_mutex->holder_id ) ) {
+
+ switch ( the_mutex->Attributes.discipline ) {
+ case CORE_MUTEX_DISCIPLINES_FIFO:
+ case CORE_MUTEX_DISCIPLINES_PRIORITY:
+ break;
+ case CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING:
+ case CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT:
+ return( CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE );
+ break;
+ }
+ }
the_mutex->nest_count--;