RTEMS
barrierwait.c
Go to the documentation of this file.
1 
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 #ifdef HAVE_CONFIG_H
18 #include "config.h"
19 #endif
20 
22 #include <rtems/rtems/statusimpl.h>
23 
24 THREAD_QUEUE_OBJECT_ASSERT(
26  Barrier.Wait_queue,
27  BARRIER_CONTROL
28 );
29 
31  rtems_id id,
32  rtems_interval timeout
33 )
34 {
35  Barrier_Control *the_barrier;
36  Thread_queue_Context queue_context;
37  Status_Control status;
38 
39  the_barrier = _Barrier_Get( id, &queue_context );
40 
41  if ( the_barrier == NULL ) {
42  return RTEMS_INVALID_ID;
43  }
44 
45  _Thread_queue_Context_set_enqueue_timeout_ticks( &queue_context, timeout );
46  status = _CORE_barrier_Seize(
47  &the_barrier->Barrier,
48  _Thread_Executing,
49  true,
50  &queue_context
51  );
52  return _Status_Get( status );
53 }
Thread queue context for the thread queue methods.
Definition: threadq.h:198
rtems_status_code rtems_barrier_wait(rtems_id id, rtems_interval timeout)
%
Definition: barrierwait.c:30
static __inline__ void _Thread_queue_Context_set_enqueue_timeout_ticks(Thread_queue_Context *queue_context, Watchdog_Interval ticks)
Sets the enqueue callout to add a relative monotonic timeout in ticks.
Definition: threadqimpl.h:262
Status_Control _CORE_barrier_Seize(CORE_barrier_Control *the_barrier, Thread_Control *executing, bool wait, Thread_queue_Context *queue_context)
Waits for the barrier.
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:82
Classic Status Implementation.
Watchdog_Interval rtems_interval
This type is used to represent clock tick intervals.
Definition: types.h:90
This status code indicates that an object identifier was invalid.
Definition: status.h:106
Objects_Id rtems_id
Values of this type identify an RTEMS object.
Definition: types.h:99
CORE_barrier_Control Barrier
Definition: barrierdata.h:42
Classic Barrier Manager Implementation.