diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-04-20 14:01:02 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-04-22 09:25:09 +0200 |
commit | f27383a518836881b7b9b88e88d2e31d5b23d048 (patch) | |
tree | ecdccfa9c902a5a8db0918026e8074af0b581a6a /cpukit/score/src/corebarrierrelease.c | |
parent | score: Add _Thread_queue_Flush_default_filter() (diff) | |
download | rtems-f27383a518836881b7b9b88e88d2e31d5b23d048.tar.bz2 |
score: Avoid Giant lock for barriers
Use _Thread_queue_Flush_critical() to atomically release the barrier.
Update #2555.
Diffstat (limited to 'cpukit/score/src/corebarrierrelease.c')
-rw-r--r-- | cpukit/score/src/corebarrierrelease.c | 36 |
1 files changed, 13 insertions, 23 deletions
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 <rtems/score/corebarrierimpl.h> -#include <rtems/score/objectimpl.h> -#include <rtems/score/threadqimpl.h> 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 + ); } |