source: rtems/cpukit/rtems/src/barrierwait.c @ 2d2352b

4.115
Last change on this file since 2d2352b was 2d2352b, checked in by Sebastian Huber <sebastian.huber@…>, on 06/05/13 at 09:48:57

score: Add and use _Objects_Put()

Add and use _Objects_Put_without_thread_dispatch(). These two functions
pair with the _Objects_Get() function. This helps to introduce object
specific SMP locks to avoid lock contention.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Barrier Wait
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.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/system.h>
22#include <rtems/rtems/status.h>
23#include <rtems/rtems/support.h>
24#include <rtems/rtems/barrier.h>
25#include <rtems/score/thread.h>
26#include <rtems/score/threadq.h>
27
28rtems_status_code rtems_barrier_wait(
29  rtems_id        id,
30  rtems_interval  timeout
31)
32{
33  Barrier_Control   *the_barrier;
34  Objects_Locations  location;
35
36  the_barrier = _Barrier_Get( id, &location );
37  switch ( location ) {
38
39    case OBJECTS_LOCAL:
40      _CORE_barrier_Wait(
41        &the_barrier->Barrier,
42        id,
43        true,
44        timeout,
45        NULL
46      );
47      _Objects_Put( &the_barrier->Object );
48      return _Barrier_Translate_core_barrier_return_code(
49                _Thread_Executing->Wait.return_code );
50
51#if defined(RTEMS_MULTIPROCESSING)
52    case OBJECTS_REMOTE:
53#endif
54    case OBJECTS_ERROR:
55      break;
56  }
57
58  return RTEMS_INVALID_ID;
59}
Note: See TracBrowser for help on using the repository browser.