summaryrefslogtreecommitdiffstats
path: root/c/src/exec/score/src/coremutexsurrender.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2001-08-30 18:32:12 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2001-08-30 18:32:12 +0000
commit6f1118a0c53cca28c85318ced92be4a6f1fa07a4 (patch)
tree736405a43568738ac4d7685cb8f0e2a53fdb9809 /c/src/exec/score/src/coremutexsurrender.c
parent2001-08-30 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-6f1118a0c53cca28c85318ced92be4a6f1fa07a4.tar.bz2
2001-08-30 Joel Sherrill <joel@OARcorp.com>
* src/coremutex.c, src/coremutexseize.c, src/coremutexsurrender.c: The per thread field resource_count should only be manipulated when a mutex is priority ceiling or priority inherit. This was reported by Chris Johns <ccj@acm.org> who also noticed that the use of switches for all disciplines generated less efficient code than using explicit tests for the one or two cases we were really interested in. Further review of his modifications made it apparent that the "isa" methods to test mutex discipline were not being used so this modification was swept into the code as well.
Diffstat (limited to '')
-rw-r--r--c/src/exec/score/src/coremutexsurrender.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/c/src/exec/score/src/coremutexsurrender.c b/c/src/exec/score/src/coremutexsurrender.c
index c4dda7e3a7..badc2617f6 100644
--- a/c/src/exec/score/src/coremutexsurrender.c
+++ b/c/src/exec/score/src/coremutexsurrender.c
@@ -86,7 +86,9 @@ CORE_mutex_Status _CORE_mutex_Surrender(
}
}
- holder->resource_count--;
+ if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ||
+ _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) )
+ holder->resource_count--;
the_mutex->holder = NULL;
the_mutex->holder_id = 0;
@@ -96,20 +98,14 @@ CORE_mutex_Status _CORE_mutex_Surrender(
* mutex (i.e. resource) this task has.
*/
- 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:
- if ( holder->resource_count == 0 &&
- holder->real_priority != holder->current_priority ) {
- _Thread_Change_priority( holder, holder->real_priority, TRUE );
- }
- break;
+ if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ||
+ _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
+ if ( holder->resource_count == 0 &&
+ holder->real_priority != holder->current_priority ) {
+ _Thread_Change_priority( holder, holder->real_priority, TRUE );
+ }
}
-
if ( ( the_thread = _Thread_queue_Dequeue( &the_mutex->Wait_queue ) ) ) {
#if defined(RTEMS_MULTIPROCESSING)