From e709aa8522788a45adc0adf22daac82c574fcae4 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 13 Jul 2015 13:49:35 +0200 Subject: score: Move wait flag update to tq extract This makes it possible to use _Thread_queue_Extract_locked() for barrier operations which extract all threads on the queue in one critical section. --- cpukit/score/src/coremutexsurrender.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'cpukit/score/src/coremutexsurrender.c') diff --git a/cpukit/score/src/coremutexsurrender.c b/cpukit/score/src/coremutexsurrender.c index e3f0d6f2e4..d3f965d55d 100644 --- a/cpukit/score/src/coremutexsurrender.c +++ b/cpukit/score/src/coremutexsurrender.c @@ -179,13 +179,15 @@ CORE_mutex_Status _CORE_mutex_Surrender( * transfer the mutex to that thread. */ if ( ( the_thread = _Thread_queue_First_locked( &the_mutex->Wait_queue ) ) ) { + bool unblock; + /* * We must extract the thread now since this will restore its default * thread lock. This is necessary to avoid a deadlock in the * _Thread_Change_priority() below due to a recursive thread queue lock * acquire. */ - _Thread_queue_Extract_locked( + unblock = _Thread_queue_Extract_locked( &the_mutex->Wait_queue.Queue, the_mutex->Wait_queue.operations, the_thread @@ -220,6 +222,7 @@ CORE_mutex_Status _CORE_mutex_Surrender( } _Thread_queue_Unblock_critical( + unblock, &the_mutex->Wait_queue.Queue, the_thread, lock_context -- cgit v1.2.3