1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup ClassicBarrierImpl |
---|
5 | * |
---|
6 | * @brief Classic Barrier Manager Implementation |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * COPYRIGHT (c) 1989-2008. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.org/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #ifndef _RTEMS_RTEMS_BARRIERIMPL_H |
---|
19 | #define _RTEMS_RTEMS_BARRIERIMPL_H |
---|
20 | |
---|
21 | #include <rtems/rtems/barrierdata.h> |
---|
22 | #include <rtems/score/corebarrierimpl.h> |
---|
23 | #include <rtems/score/objectimpl.h> |
---|
24 | |
---|
25 | #ifdef __cplusplus |
---|
26 | extern "C" { |
---|
27 | #endif |
---|
28 | |
---|
29 | /** |
---|
30 | * @defgroup ClassicBarrierImpl Classic Barrier Implementation |
---|
31 | * |
---|
32 | * @ingroup ClassicBarrier |
---|
33 | * |
---|
34 | * @{ |
---|
35 | */ |
---|
36 | |
---|
37 | /** |
---|
38 | * @brief _Barrier_Allocate |
---|
39 | * |
---|
40 | * This function allocates a barrier control block from |
---|
41 | * the inactive chain of free barrier control blocks. |
---|
42 | */ |
---|
43 | RTEMS_INLINE_ROUTINE Barrier_Control *_Barrier_Allocate( void ) |
---|
44 | { |
---|
45 | return (Barrier_Control *) _Objects_Allocate( &_Barrier_Information ); |
---|
46 | } |
---|
47 | |
---|
48 | /** |
---|
49 | * @brief _Barrier_Free |
---|
50 | * |
---|
51 | * This routine frees a barrier control block to the |
---|
52 | * inactive chain of free barrier control blocks. |
---|
53 | */ |
---|
54 | RTEMS_INLINE_ROUTINE void _Barrier_Free ( |
---|
55 | Barrier_Control *the_barrier |
---|
56 | ) |
---|
57 | { |
---|
58 | _CORE_barrier_Destroy( &the_barrier->Barrier ); |
---|
59 | _Objects_Free( &_Barrier_Information, &the_barrier->Object ); |
---|
60 | } |
---|
61 | |
---|
62 | RTEMS_INLINE_ROUTINE Barrier_Control *_Barrier_Get( |
---|
63 | Objects_Id id, |
---|
64 | Thread_queue_Context *queue_context |
---|
65 | ) |
---|
66 | { |
---|
67 | _Thread_queue_Context_initialize( queue_context ); |
---|
68 | return (Barrier_Control *) _Objects_Get( |
---|
69 | id, |
---|
70 | &queue_context->Lock_context.Lock_context, |
---|
71 | &_Barrier_Information |
---|
72 | ); |
---|
73 | } |
---|
74 | |
---|
75 | /**@}*/ |
---|
76 | |
---|
77 | #ifdef __cplusplus |
---|
78 | } |
---|
79 | #endif |
---|
80 | |
---|
81 | #endif |
---|
82 | /* end of include file */ |
---|