summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-03-30 15:00:29 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-04-06 09:08:20 +0200
commite581ea9218578364e867b4d2f59635f6dd6a4eeb (patch)
tree4ecc5168bd8d5bbba3d9530a867410ee402df94c
parentscore: Delete MP support for RW locks (diff)
downloadrtems-e581ea9218578364e867b4d2f59635f6dd6a4eeb.tar.bz2
score: Fix _Thread_queue_Extract_locked()
We must update the wait flags under protection of the current thread lock, otherwise a _Thread_Timeout() running on another processor may interfere.
-rw-r--r--cpukit/score/src/threadqenqueue.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/cpukit/score/src/threadqenqueue.c b/cpukit/score/src/threadqenqueue.c
index 803b5568b3..71e93c292d 100644
--- a/cpukit/score/src/threadqenqueue.c
+++ b/cpukit/score/src/threadqenqueue.c
@@ -116,10 +116,10 @@ bool _Thread_queue_Extract_locked(
( *operations->extract )( queue, the_thread );
- _Thread_Wait_set_queue( the_thread, NULL );
- _Thread_Wait_restore_default_operations( the_thread );
- _Thread_Lock_restore_default( the_thread );
-
+ /*
+ * We must update the wait flags under protection of the current thread lock,
+ * otherwise a _Thread_Timeout() running on another processor may interfere.
+ */
success = _Thread_Wait_flags_try_change_critical(
the_thread,
THREAD_QUEUE_INTEND_TO_BLOCK,
@@ -133,6 +133,10 @@ bool _Thread_queue_Extract_locked(
unblock = true;
}
+ _Thread_Wait_set_queue( the_thread, NULL );
+ _Thread_Wait_restore_default_operations( the_thread );
+ _Thread_Lock_restore_default( the_thread );
+
return unblock;
}