From f27383a518836881b7b9b88e88d2e31d5b23d048 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 20 Apr 2016 14:01:02 +0200 Subject: score: Avoid Giant lock for barriers Use _Thread_queue_Flush_critical() to atomically release the barrier. Update #2555. --- cpukit/score/src/corebarrierrelease.c | 36 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 23 deletions(-) (limited to 'cpukit/score/src/corebarrierrelease.c') diff --git a/cpukit/score/src/corebarrierrelease.c b/cpukit/score/src/corebarrierrelease.c index 6d72203e7e..e6ef335abc 100644 --- a/cpukit/score/src/corebarrierrelease.c +++ b/cpukit/score/src/corebarrierrelease.c @@ -20,34 +20,24 @@ #endif #include -#include -#include uint32_t _CORE_barrier_Do_surrender( - CORE_barrier_Control *the_barrier + CORE_barrier_Control *the_barrier, + Thread_queue_Flush_filter filter, #if defined(RTEMS_MULTIPROCESSING) - , - Thread_queue_MP_callout mp_callout, - Objects_Id mp_id + Thread_queue_MP_callout mp_callout, + Objects_Id mp_id, #endif + ISR_lock_Context *lock_context ) { - Thread_Control *the_thread; - uint32_t count; - - count = 0; - while ( - ( - the_thread = _Thread_queue_Dequeue( - &the_barrier->Wait_queue, - CORE_BARRIER_TQ_OPERATIONS, - mp_callout, - mp_id - ) - ) - ) { - count++; - } the_barrier->number_of_waiting_threads = 0; - return count; + return _Thread_queue_Flush_critical( + &the_barrier->Wait_queue.Queue, + CORE_BARRIER_TQ_OPERATIONS, + filter, + mp_callout, + mp_id, + lock_context + ); } -- cgit v1.2.3