summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/barrierdelete.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-04-20 14:01:02 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-04-22 09:25:09 +0200
commitf27383a518836881b7b9b88e88d2e31d5b23d048 (patch)
treeecdccfa9c902a5a8db0918026e8074af0b581a6a /cpukit/rtems/src/barrierdelete.c
parentscore: Add _Thread_queue_Flush_default_filter() (diff)
downloadrtems-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/rtems/src/barrierdelete.c')
-rw-r--r--cpukit/rtems/src/barrierdelete.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/cpukit/rtems/src/barrierdelete.c b/cpukit/rtems/src/barrierdelete.c
index 5d87e636a4..d742327d20 100644
--- a/cpukit/rtems/src/barrierdelete.c
+++ b/cpukit/rtems/src/barrierdelete.c
@@ -19,35 +19,26 @@
#endif
#include <rtems/rtems/barrierimpl.h>
-#include <rtems/score/threadqimpl.h>
rtems_status_code rtems_barrier_delete(
rtems_id id
)
{
- Barrier_Control *the_barrier;
- Objects_Locations location;
+ Barrier_Control *the_barrier;
+ ISR_lock_Context lock_context;
_Objects_Allocator_lock();
- the_barrier = _Barrier_Get( id, &location );
- switch ( location ) {
+ the_barrier = _Barrier_Get( id, &lock_context );
- case OBJECTS_LOCAL:
- _Objects_Close( &_Barrier_Information, &the_barrier->Object );
- _CORE_barrier_Flush( &the_barrier->Barrier, NULL, 0 );
- _Objects_Put( &the_barrier->Object );
- _Barrier_Free( the_barrier );
- _Objects_Allocator_unlock();
- return RTEMS_SUCCESSFUL;
-
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- break;
+ if ( the_barrier == NULL ) {
+ _Objects_Allocator_unlock();
+ return RTEMS_INVALID_ID;
}
+ _CORE_barrier_Acquire_critical( &the_barrier->Barrier, &lock_context );
+ _Objects_Close( &_Barrier_Information, &the_barrier->Object );
+ _CORE_barrier_Flush( &the_barrier->Barrier, NULL, 0, &lock_context );
+ _Barrier_Free( the_barrier );
_Objects_Allocator_unlock();
-
- return RTEMS_INVALID_ID;
+ return RTEMS_SUCCESSFUL;
}