diff options
-rw-r--r-- | c/src/exec/score/src/threadq.c | 19 | ||||
-rw-r--r-- | cpukit/score/src/threadq.c | 19 |
2 files changed, 24 insertions, 14 deletions
diff --git a/c/src/exec/score/src/threadq.c b/c/src/exec/score/src/threadq.c index f388959268..dc52efa954 100644 --- a/c/src/exec/score/src/threadq.c +++ b/c/src/exec/score/src/threadq.c @@ -366,9 +366,10 @@ void _Thread_queue_Enqueue_fifo ( _ISR_Disable( level ); + the_thread_queue->sync = FALSE; + switch ( the_thread_queue->sync_state ) { case THREAD_QUEUE_NOTHING_HAPPENED: - the_thread_queue->sync = FALSE; _Chain_Append_unprotected( &the_thread_queue->Queues.Fifo, &the_thread->Object.Node @@ -448,7 +449,8 @@ Thread_Control *_Thread_queue_Dequeue_fifo( _Thread_MP_Free_proxy( the_thread ); return the_thread; - } else if ( the_thread_queue->sync ) { + } else if ( the_thread_queue->sync && + the_thread_queue->sync_state != THREAD_QUEUE_SATISFIED ) { the_thread_queue->sync_state = THREAD_QUEUE_SATISFIED; _ISR_Enable( level ); return _Thread_Executing; @@ -602,11 +604,12 @@ restart_forward_search: search_thread = (Thread_Control *)search_thread->Object.Node.next; } - if ( the_thread_queue->sync_state != THREAD_QUEUE_NOTHING_HAPPENED ) - goto syncronize; the_thread_queue->sync = FALSE; + if ( the_thread_queue->sync_state != THREAD_QUEUE_NOTHING_HAPPENED ) + goto syncronize; + if ( priority == search_priority ) goto equal_priority; @@ -646,11 +649,12 @@ restart_reverse_search: search_thread = (Thread_Control *) search_thread->Object.Node.previous; } - if ( the_thread_queue->sync_state != THREAD_QUEUE_NOTHING_HAPPENED ) - goto syncronize; the_thread_queue->sync = FALSE; + if ( the_thread_queue->sync_state != THREAD_QUEUE_NOTHING_HAPPENED ) + goto syncronize; + if ( priority == search_priority ) goto equal_priority; @@ -755,7 +759,8 @@ Thread_Control *_Thread_queue_Dequeue_priority( } } - if ( the_thread_queue->sync ) { + if ( the_thread_queue->sync && + the_thread_queue->sync_state != THREAD_QUEUE_SATISFIED ) { the_thread_queue->sync_state = THREAD_QUEUE_SATISFIED; _ISR_Enable( level ); return _Thread_Executing; diff --git a/cpukit/score/src/threadq.c b/cpukit/score/src/threadq.c index f388959268..dc52efa954 100644 --- a/cpukit/score/src/threadq.c +++ b/cpukit/score/src/threadq.c @@ -366,9 +366,10 @@ void _Thread_queue_Enqueue_fifo ( _ISR_Disable( level ); + the_thread_queue->sync = FALSE; + switch ( the_thread_queue->sync_state ) { case THREAD_QUEUE_NOTHING_HAPPENED: - the_thread_queue->sync = FALSE; _Chain_Append_unprotected( &the_thread_queue->Queues.Fifo, &the_thread->Object.Node @@ -448,7 +449,8 @@ Thread_Control *_Thread_queue_Dequeue_fifo( _Thread_MP_Free_proxy( the_thread ); return the_thread; - } else if ( the_thread_queue->sync ) { + } else if ( the_thread_queue->sync && + the_thread_queue->sync_state != THREAD_QUEUE_SATISFIED ) { the_thread_queue->sync_state = THREAD_QUEUE_SATISFIED; _ISR_Enable( level ); return _Thread_Executing; @@ -602,11 +604,12 @@ restart_forward_search: search_thread = (Thread_Control *)search_thread->Object.Node.next; } - if ( the_thread_queue->sync_state != THREAD_QUEUE_NOTHING_HAPPENED ) - goto syncronize; the_thread_queue->sync = FALSE; + if ( the_thread_queue->sync_state != THREAD_QUEUE_NOTHING_HAPPENED ) + goto syncronize; + if ( priority == search_priority ) goto equal_priority; @@ -646,11 +649,12 @@ restart_reverse_search: search_thread = (Thread_Control *) search_thread->Object.Node.previous; } - if ( the_thread_queue->sync_state != THREAD_QUEUE_NOTHING_HAPPENED ) - goto syncronize; the_thread_queue->sync = FALSE; + if ( the_thread_queue->sync_state != THREAD_QUEUE_NOTHING_HAPPENED ) + goto syncronize; + if ( priority == search_priority ) goto equal_priority; @@ -755,7 +759,8 @@ Thread_Control *_Thread_queue_Dequeue_priority( } } - if ( the_thread_queue->sync ) { + if ( the_thread_queue->sync && + the_thread_queue->sync_state != THREAD_QUEUE_SATISFIED ) { the_thread_queue->sync_state = THREAD_QUEUE_SATISFIED; _ISR_Enable( level ); return _Thread_Executing; |