summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2006-07-11 21:03:50 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2006-07-11 21:03:50 +0000
commit70f244005578c1a44af3230dc0fa1378d7172df5 (patch)
tree9fdf2f66d50ab67323f2ac03c4629753d95e0e74
parent575b66a70466c7d0ecd27ada7671b96cd794afca (diff)
2006-07-11 Joel Sherrill <joel@OARcorp.com>
PR 1124/rtems * src/coremutexseize.c, src/coremutexsurrender.c, src/threadqenqueue.c, src/threadqenqueuefifo.c, 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.
-rw-r--r--cpukit/score/ChangeLog11
-rw-r--r--cpukit/score/src/coremutexseize.c18
-rw-r--r--cpukit/score/src/coremutexsurrender.c27
-rw-r--r--cpukit/score/src/threadqenqueue.c4
-rw-r--r--cpukit/score/src/threadqenqueuefifo.c7
-rw-r--r--cpukit/score/src/threadqenqueuepriority.c7
6 files changed, 37 insertions, 37 deletions
diff --git a/cpukit/score/ChangeLog b/cpukit/score/ChangeLog
index 774598b495..4373363f77 100644
--- a/cpukit/score/ChangeLog
+++ b/cpukit/score/ChangeLog
@@ -1,3 +1,14 @@
+2006-07-11 Joel Sherrill <joel@OARcorp.com>
+
+ PR 1124/rtems
+ * src/coremutexseize.c, src/coremutexsurrender.c, src/threadqenqueue.c,
+ src/threadqenqueuefifo.c, 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.
+
2006-06-22 Joel Sherrill <joel@OARcorp.com>
PR 1101/rtems
diff --git a/cpukit/score/src/coremutexseize.c b/cpukit/score/src/coremutexseize.c
index b106155874..34a6b4a9ee 100644
--- a/cpukit/score/src/coremutexseize.c
+++ b/cpukit/score/src/coremutexseize.c
@@ -6,7 +6,7 @@
* This package is the implementation of the Mutex Handler.
* This handler provides synchronization and mutual exclusion capabilities.
*
- * COPYRIGHT (c) 1989-1999.
+ * COPYRIGHT (c) 1989-2006.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -56,22 +56,6 @@ void _CORE_mutex_Seize_interrupt_blocking(
the_mutex->blocked_count++;
_Thread_queue_Enqueue( &the_mutex->Wait_queue, timeout );
- if ( _Thread_Executing->Wait.return_code == CORE_MUTEX_STATUS_SUCCESSFUL ) {
- /*
- * if CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT then nothing to do
- * because this task is already the highest priority.
- */
-
- if ( _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
- if (the_mutex->Attributes.priority_ceiling < executing->current_priority){
- _Thread_Change_priority(
- executing,
- the_mutex->Attributes.priority_ceiling,
- FALSE
- );
- }
- }
- }
_Thread_Enable_dispatch();
}
diff --git a/cpukit/score/src/coremutexsurrender.c b/cpukit/score/src/coremutexsurrender.c
index 88810ac3bb..571bfe0ab1 100644
--- a/cpukit/score/src/coremutexsurrender.c
+++ b/cpukit/score/src/coremutexsurrender.c
@@ -123,16 +123,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;
diff --git a/cpukit/score/src/threadqenqueue.c b/cpukit/score/src/threadqenqueue.c
index 9bffa0e08f..b3bd7ba31b 100644
--- a/cpukit/score/src/threadqenqueue.c
+++ b/cpukit/score/src/threadqenqueue.c
@@ -67,10 +67,10 @@ void _Thread_queue_Enqueue(
switch( the_thread_queue->discipline ) {
case THREAD_QUEUE_DISCIPLINE_FIFO:
- _Thread_queue_Enqueue_fifo( the_thread_queue, the_thread, timeout );
+ _Thread_queue_Enqueue_fifo( the_thread_queue, the_thread );
break;
case THREAD_QUEUE_DISCIPLINE_PRIORITY:
- _Thread_queue_Enqueue_priority( the_thread_queue, the_thread, timeout );
+ _Thread_queue_Enqueue_priority( the_thread_queue, the_thread );
break;
}
}
diff --git a/cpukit/score/src/threadqenqueuefifo.c b/cpukit/score/src/threadqenqueuefifo.c
index fc336d0ce0..c345644e88 100644
--- a/cpukit/score/src/threadqenqueuefifo.c
+++ b/cpukit/score/src/threadqenqueuefifo.c
@@ -25,13 +25,11 @@
*
* _Thread_queue_Enqueue_fifo
*
- * This routine blocks a thread, places it on a thread, and optionally
- * starts a timeout timer.
+ * This routine places a blocked thread on a FIFO thread queue.
*
* Input parameters:
* the_thread_queue - pointer to threadq
* the_thread - pointer to the thread to block
- * timeout - interval to wait
*
* Output parameters: NONE
*
@@ -41,8 +39,7 @@
void _Thread_queue_Enqueue_fifo (
Thread_queue_Control *the_thread_queue,
- Thread_Control *the_thread,
- Watchdog_Interval timeout
+ Thread_Control *the_thread
)
{
ISR_Level level;
diff --git a/cpukit/score/src/threadqenqueuepriority.c b/cpukit/score/src/threadqenqueuepriority.c
index 7ac6ad4d6f..404c4945f3 100644
--- a/cpukit/score/src/threadqenqueuepriority.c
+++ b/cpukit/score/src/threadqenqueuepriority.c
@@ -25,13 +25,11 @@
*
* _Thread_queue_Enqueue_priority
*
- * This routine blocks a thread, places it on a thread, and optionally
- * starts a timeout timer.
+ * This routine places a blocked thread on a priority thread queue.
*
* Input parameters:
* the_thread_queue - pointer to threadq
* thread - thread to insert
- * timeout - timeout interval in ticks
*
* Output parameters: NONE
*
@@ -42,8 +40,7 @@
void _Thread_queue_Enqueue_priority(
Thread_queue_Control *the_thread_queue,
- Thread_Control *the_thread,
- Watchdog_Interval timeout
+ Thread_Control *the_thread
)
{
Priority_Control search_priority;