source: rtems/cpukit/rtems/src/barrierdelete.c @ f27383a

5
Last change on this file since f27383a was f27383a, checked in by Sebastian Huber <sebastian.huber@…>, on 04/20/16 at 12:01:02

score: Avoid Giant lock for barriers

Use _Thread_queue_Flush_critical() to atomically release the barrier.

Update #2555.

  • Property mode set to 100644
File size: 1.0 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Delete Barrier
5 *  @ingroup ClassicBarrier
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2007.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/rtems/barrierimpl.h>
22
23rtems_status_code rtems_barrier_delete(
24  rtems_id   id
25)
26{
27  Barrier_Control  *the_barrier;
28  ISR_lock_Context  lock_context;
29
30  _Objects_Allocator_lock();
31  the_barrier = _Barrier_Get( id, &lock_context );
32
33  if ( the_barrier == NULL ) {
34    _Objects_Allocator_unlock();
35    return RTEMS_INVALID_ID;
36  }
37
38  _CORE_barrier_Acquire_critical( &the_barrier->Barrier, &lock_context );
39  _Objects_Close( &_Barrier_Information, &the_barrier->Object );
40  _CORE_barrier_Flush( &the_barrier->Barrier, NULL, 0, &lock_context );
41  _Barrier_Free( the_barrier );
42  _Objects_Allocator_unlock();
43  return RTEMS_SUCCESSFUL;
44}
Note: See TracBrowser for help on using the repository browser.