summaryrefslogtreecommitdiffstats
path: root/cpukit/score
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2006-07-11 21:05:12 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2006-07-11 21:05:12 +0000
commit83df49f697d770276c16af18884e2c4aeb393ab8 (patch)
treea8ad7983ebe4162b4768ab46edc7dd28df93fea0 /cpukit/score
parentfixed system.h: only include ATA/IDE driver, when BSP supports an ide interface (diff)
downloadrtems-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')
-rw-r--r--cpukit/score/include/rtems/score/threadq.h6
-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, 28 insertions, 41 deletions
diff --git a/cpukit/score/include/rtems/score/threadq.h b/cpukit/score/include/rtems/score/threadq.h
index 86dcbac39b..51ac3377ba 100644
--- a/cpukit/score/include/rtems/score/threadq.h
+++ b/cpukit/score/include/rtems/score/threadq.h
@@ -143,8 +143,7 @@ Thread_Control *_Thread_queue_Dequeue_priority(
*/
void _Thread_queue_Enqueue_priority(
Thread_queue_Control *the_thread_queue,
- Thread_Control *the_thread,
- Watchdog_Interval timeout
+ Thread_Control *the_thread
);
/** @brief Thread queue Extract priority
@@ -185,8 +184,7 @@ Thread_Control *_Thread_queue_Dequeue_fifo(
*/
void _Thread_queue_Enqueue_fifo(
Thread_queue_Control *the_thread_queue,
- Thread_Control *the_thread,
- Watchdog_Interval timeout
+ Thread_Control *the_thread
);
/** @brief Thread queue Extract FIFO
diff --git a/cpukit/score/src/coremutexseize.c b/cpukit/score/src/coremutexseize.c
index cd620c3e9d..6b04d200ac 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
@@ -60,22 +60,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 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;
diff --git a/cpukit/score/src/threadqenqueue.c b/cpukit/score/src/threadqenqueue.c
index 61bbb0cccb..848b256b53 100644
--- a/cpukit/score/src/threadqenqueue.c
+++ b/cpukit/score/src/threadqenqueue.c
@@ -74,10 +74,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 2cd5166356..b4cba6a532 100644
--- a/cpukit/score/src/threadqenqueuefifo.c
+++ b/cpukit/score/src/threadqenqueuefifo.c
@@ -29,13 +29,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
*
@@ -45,8 +43,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 b5154b8c76..5c49a4c6d8 100644
--- a/cpukit/score/src/threadqenqueuepriority.c
+++ b/cpukit/score/src/threadqenqueuepriority.c
@@ -29,13 +29,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
*
@@ -46,8 +44,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;