Modified to make it possible for an ISR to return a mutex which did

not use priority ceiling or priority inheritance protocols.
This commit is contained in:
Joel Sherrill
1998-02-20 20:23:57 +00:00
parent ee7f4e3468
commit 9b39bab01d
2 changed files with 40 additions and 4 deletions

View File

@@ -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 ) )
_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--;

View File

@@ -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 ) )
_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--;