From f00a0522a48cbd903e830c4b24e1c9407ca1f6df Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 1 Feb 1996 21:54:40 +0000 Subject: synchronization state bugs address --- cpukit/score/src/threadq.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'cpukit') 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; -- cgit v1.2.3