diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-09-19 14:19:55 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-09-19 14:25:34 +0200 |
commit | 90ce69b0f19ab410d502fa93a64f02de55cf4a53 (patch) | |
tree | 7524648588077239236f75ff44598d928edfcbb9 | |
parent | sptests/spintrcritical22: New test (diff) | |
download | rtems-90ce69b0f19ab410d502fa93a64f02de55cf4a53.tar.bz2 |
score: Critical fix for _Thread_queue_Dequeue()
Do not return NULL in case we can dequeue the executing thread. This
bug was introduced with 32506647001a815e3c0daf25757d386104a07184.
-rw-r--r-- | cpukit/score/src/threadqdequeue.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/cpukit/score/src/threadqdequeue.c b/cpukit/score/src/threadqdequeue.c index e364aa91e8..52ba009021 100644 --- a/cpukit/score/src/threadqdequeue.c +++ b/cpukit/score/src/threadqdequeue.c @@ -54,18 +54,20 @@ Thread_Control *_Thread_queue_Dequeue( } } - /* - * We did not find a thread to unblock. - */ - if ( !the_thread ) { + if ( the_thread == NULL ) { + /* + * We did not find a thread to unblock in the queue. Maybe the executing + * thread is about to block on this thread queue. + */ sync_state = the_thread_queue->sync_state; if ( (sync_state == THREAD_BLOCKING_OPERATION_TIMEOUT) || (sync_state == THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED) ) { the_thread_queue->sync_state = THREAD_BLOCKING_OPERATION_SATISFIED; the_thread = _Thread_Executing; + } else { + _ISR_Enable( level ); + return NULL; } - _ISR_Enable( level ); - return NULL; } /* |