From 96d0b64c620a2107a5d6b076a17ab26fca6b2a39 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 5 Mar 2007 21:01:40 +0000 Subject: 2007-03-05 Joel Sherrill PR 1222/cpukit * score/Makefile.am, score/include/rtems/score/coremutex.h, score/include/rtems/score/threadq.h, score/inline/rtems/score/coremutex.inl, score/src/coremsgsubmit.c, score/src/coremutexsurrender.c, score/src/threadchangepriority.c, score/src/threadclearstate.c, score/src/threadhandler.c, score/src/threadinitialize.c, score/src/threadqdequeuefifo.c, score/src/threadqdequeuepriority.c, score/src/threadqenqueue.c, score/src/threadqenqueuefifo.c, score/src/threadqenqueuepriority.c, score/src/threadqextractfifo.c, score/src/threadqextractpriority.c, score/src/threadsetstate.c: Enhance so that when the prioirity of a thread that is blocked on a priority based thread queue is changed, that its placement in the queue is reevaluated based upon the new priority. This enhancement includes modifications to the SuperCore as well as new test cases. * score/src/threadqrequeue.c: New file. --- cpukit/score/src/threadqenqueuepriority.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'cpukit/score/src/threadqenqueuepriority.c') diff --git a/cpukit/score/src/threadqenqueuepriority.c b/cpukit/score/src/threadqenqueuepriority.c index 5c49a4c6d8..9974a3a674 100644 --- a/cpukit/score/src/threadqenqueuepriority.c +++ b/cpukit/score/src/threadqenqueuepriority.c @@ -108,10 +108,11 @@ restart_forward_search: previous_node = search_node->previous; the_node = (Chain_Node *) the_thread; - the_node->next = search_node; - the_node->previous = previous_node; - previous_node->next = the_node; - search_node->previous = the_node; + the_node->next = search_node; + the_node->previous = previous_node; + previous_node->next = the_node; + search_node->previous = the_node; + the_thread->Wait.queue = the_thread_queue; _ISR_Enable( level ); return; @@ -153,10 +154,11 @@ restart_reverse_search: next_node = search_node->next; the_node = (Chain_Node *) the_thread; - the_node->next = next_node; - the_node->previous = search_node; - search_node->next = the_node; - next_node->previous = the_node; + the_node->next = next_node; + the_node->previous = search_node; + search_node->next = the_node; + next_node->previous = the_node; + the_thread->Wait.queue = the_thread_queue; _ISR_Enable( level ); return; @@ -165,10 +167,11 @@ equal_priority: /* add at end of priority group */ previous_node = search_node->previous; the_node = (Chain_Node *) the_thread; - the_node->next = search_node; - the_node->previous = previous_node; - previous_node->next = the_node; - search_node->previous = the_node; + the_node->next = search_node; + the_node->previous = previous_node; + previous_node->next = the_node; + search_node->previous = the_node; + the_thread->Wait.queue = the_thread_queue; _ISR_Enable( level ); return; @@ -193,12 +196,14 @@ synchronize: case THREAD_QUEUE_TIMEOUT: the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status; + the_thread->Wait.queue = NULL; _ISR_Enable( level ); break; case THREAD_QUEUE_SATISFIED: if ( _Watchdog_Is_active( &the_thread->Timer ) ) { _Watchdog_Deactivate( &the_thread->Timer ); + the_thread->Wait.queue = NULL; _ISR_Enable( level ); (void) _Watchdog_Remove( &the_thread->Timer ); } else -- cgit v1.2.3