5
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.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <rtems/rtems/barrierimpl.h> |
---|
22 | #include <rtems/rtems/statusimpl.h> |
---|
23 | |
---|
24 | THREAD_QUEUE_OBJECT_ASSERT( Barrier_Control, Barrier.Wait_queue ); |
---|
25 | |
---|
26 | rtems_status_code rtems_barrier_wait( |
---|
27 | rtems_id id, |
---|
28 | rtems_interval timeout |
---|
29 | ) |
---|
30 | { |
---|
31 | Barrier_Control *the_barrier; |
---|
32 | Thread_queue_Context queue_context; |
---|
33 | Status_Control status; |
---|
34 | |
---|
35 | the_barrier = _Barrier_Get( id, &queue_context ); |
---|
36 | |
---|
37 | if ( the_barrier == NULL ) { |
---|
38 | return RTEMS_INVALID_ID; |
---|
39 | } |
---|
40 | |
---|
41 | _Thread_queue_Context_set_enqueue_timeout_ticks( &queue_context, timeout ); |
---|
42 | status = _CORE_barrier_Seize( |
---|
43 | &the_barrier->Barrier, |
---|
44 | _Thread_Executing, |
---|
45 | true, |
---|
46 | &queue_context |
---|
47 | ); |
---|
48 | return _Status_Get( status ); |
---|
49 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.