summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-09-19 14:19:55 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-09-19 14:25:34 +0200
commit90ce69b0f19ab410d502fa93a64f02de55cf4a53 (patch)
tree7524648588077239236f75ff44598d928edfcbb9
parent6f1e1b308ca30b7340976f56c9567c64e4944067 (diff)
downloadrtems-90ce69b0f19ab410d502.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.c14
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;
}
/*