diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2006-07-11 21:05:12 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2006-07-11 21:05:12 +0000 |
commit | 83df49f697d770276c16af18884e2c4aeb393ab8 (patch) | |
tree | a8ad7983ebe4162b4768ab46edc7dd28df93fea0 /cpukit/score/src/coremutexsurrender.c | |
parent | fixed system.h: only include ATA/IDE driver, when BSP supports an ide interface (diff) | |
download | rtems-83df49f697d770276c16af18884e2c4aeb393ab8.tar.bz2 |
2006-07-11 Joel Sherrill <joel@OARcorp.com>
PR 1124/rtems
* score/include/rtems/score/threadq.h, score/src/coremutexseize.c,
score/src/coremutexsurrender.c, score/src/threadqenqueue.c,
score/src/threadqenqueuefifo.c, score/src/threadqenqueuepriority.c:
The placement of the changing a thread's priority when using priority
ceiling should be on the successful transfer of the mutex -- not when
the thread tries to acquire. Plus the lack of a dispatch disable
point lead to the potential for a thread timing out and already
having inherited the ceiling priority.
Diffstat (limited to 'cpukit/score/src/coremutexsurrender.c')
-rw-r--r-- | cpukit/score/src/coremutexsurrender.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/cpukit/score/src/coremutexsurrender.c b/cpukit/score/src/coremutexsurrender.c index 917eef6051..e6f52e229d 100644 --- a/cpukit/score/src/coremutexsurrender.c +++ b/cpukit/score/src/coremutexsurrender.c @@ -127,16 +127,27 @@ CORE_mutex_Status _CORE_mutex_Surrender( the_mutex->holder = the_thread; the_mutex->holder_id = the_thread->Object.id; - if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) || - _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) - the_thread->resource_count++; the_mutex->nest_count = 1; - /* - * No special action for priority inheritance or priority ceiling - * because the_thread is guaranteed to be the highest priority - * thread waiting for the mutex. - */ + 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++; + break; + case CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING: + the_thread->resource_count++; + if (the_mutex->Attributes.priority_ceiling < + the_thread->current_priority){ + _Thread_Change_priority( + the_thread, + the_mutex->Attributes.priority_ceiling, + FALSE + ); + } + break; + } } } else the_mutex->lock = CORE_MUTEX_UNLOCKED; |