RTEMS
corebarrierimpl.h
Go to the documentation of this file.
1 
12 /*
13  * COPYRIGHT (c) 1989-2006.
14  * On-Line Applications Research Corporation (OAR).
15  *
16  * The license and distribution terms for this file may be
17  * found in the file LICENSE in this distribution or at
18  * http://www.rtems.org/license/LICENSE.
19  */
20 
21 #ifndef _RTEMS_SCORE_COREBARRIERIMPL_H
22 #define _RTEMS_SCORE_COREBARRIERIMPL_H
23 
25 #include <rtems/score/status.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
38 #define CORE_BARRIER_TQ_OPERATIONS &_Thread_queue_Operations_FIFO
39 
49  CORE_barrier_Control *the_barrier,
50  CORE_barrier_Attributes *the_barrier_attributes
51 );
52 
61  CORE_barrier_Control *the_barrier
62 )
63 {
64  _Thread_queue_Destroy( &the_barrier->Wait_queue );
65 }
66 
74  CORE_barrier_Control *the_barrier,
75  Thread_queue_Context *queue_context
76 )
77 {
78  _Thread_queue_Acquire_critical( &the_barrier->Wait_queue, queue_context );
79 }
80 
88  CORE_barrier_Control *the_barrier,
89  Thread_queue_Context *queue_context
90 )
91 {
92  _Thread_queue_Release( &the_barrier->Wait_queue, queue_context );
93 }
94 
110 Status_Control _CORE_barrier_Seize(
111  CORE_barrier_Control *the_barrier,
112  Thread_Control *executing,
113  bool wait,
114  Thread_queue_Context *queue_context
115 );
116 
124 uint32_t _CORE_barrier_Do_flush(
125  CORE_barrier_Control *the_barrier,
127  Thread_queue_Context *queue_context
128 );
129 
142  CORE_barrier_Control *the_barrier,
143  Thread_queue_Context *queue_context
144 )
145 {
146  return _CORE_barrier_Do_flush(
147  the_barrier,
149  queue_context
150  );
151 }
152 
160  CORE_barrier_Control *the_barrier,
161  Thread_queue_Context *queue_context
162 )
163 {
165  the_barrier,
167  queue_context
168  );
169 }
170 
183  CORE_barrier_Attributes *the_attribute
184 )
185 {
186  return
187  (the_attribute->discipline == CORE_BARRIER_AUTOMATIC_RELEASE);
188 }
189 
201  CORE_barrier_Control *the_barrier
202 )
203 {
204  return the_barrier->number_of_waiting_threads;
205 }
206 
209 #ifdef __cplusplus
210 }
211 #endif
212 
213 #endif
214 /* end of include file */
static __inline__ void _Thread_queue_Acquire_critical(Thread_queue_Control *the_thread_queue, Thread_queue_Context *queue_context)
Acquires the thread queue control in a critical section.
Definition: threadqimpl.h:681
static __inline__ void _CORE_barrier_Destroy(CORE_barrier_Control *the_barrier)
Destroys the core barrier.
void _CORE_barrier_Initialize(CORE_barrier_Control *the_barrier, CORE_barrier_Attributes *the_barrier_attributes)
Initializes the core barrier.
Definition: corebarrier.c:23
static __inline__ uint32_t _CORE_barrier_Surrender(CORE_barrier_Control *the_barrier, Thread_queue_Context *queue_context)
Manually releases the barrier.
Thread queue context for the thread queue methods.
Definition: threadq.h:198
static __inline__ uint32_t _CORE_barrier_Get_number_of_waiting_threads(CORE_barrier_Control *the_barrier)
Returns the number of currently waiting threads.
uint32_t _CORE_barrier_Do_flush(CORE_barrier_Control *the_barrier, Thread_queue_Flush_filter filter, Thread_queue_Context *queue_context)
Flushes the barrier.
Status_Control _CORE_barrier_Seize(CORE_barrier_Control *the_barrier, Thread_Control *executing, bool wait, Thread_queue_Context *queue_context)
Waits for the barrier.
Thread_Control * _Thread_queue_Flush_default_filter(Thread_Control *the_thread, Thread_queue_Queue *queue, Thread_queue_Context *queue_context)
Default thread queue flush filter function.
Definition: threadqflush.c:26
Thread_Control *(* Thread_queue_Flush_filter)(Thread_Control *the_thread, Thread_queue_Queue *queue, Thread_queue_Context *queue_context)
Thread queue flush filter function.
Definition: threadqimpl.h:1223
static __inline__ void _CORE_barrier_Release(CORE_barrier_Control *the_barrier, Thread_queue_Context *queue_context)
Releases core barrier.
Constants and Structures Associated with the Barrier Handler.
Constants and Structures Associated with the Manipulation of Objects.
Thread_Control * _Thread_queue_Flush_status_object_was_deleted(Thread_Control *the_thread, Thread_queue_Queue *queue, Thread_queue_Context *queue_context)
Status object was deleted thread queue flush filter function.
Definition: threadqflush.c:37
Thread_queue_Control Wait_queue
Definition: corebarrier.h:79
static __inline__ void _CORE_barrier_Acquire_critical(CORE_barrier_Control *the_barrier, Thread_queue_Context *queue_context)
Acquires critical core barrier.
uint32_t number_of_waiting_threads
Definition: corebarrier.h:86
static __inline__ void _CORE_barrier_Flush(CORE_barrier_Control *the_barrier, Thread_queue_Context *queue_context)
Flushes the barrier using _CORE_barrier_Do_flush().
static __inline__ void _Thread_queue_Destroy(Thread_queue_Control *the_thread_queue)
Destroys the thread queue.
Definition: threadqimpl.h:1378
#define RTEMS_INLINE_ROUTINE
Gives a hint to the compiler in a function declaration to inline this function.
Definition: basedefs.h:683
void _Thread_queue_Release(Thread_queue_Control *the_thread_queue, Thread_queue_Context *queue_context)
Releases the thread queue control and enables interrupts.
Definition: threadq.c:118
CORE_barrier_Disciplines discipline
Definition: corebarrier.h:64
static __inline__ bool _CORE_barrier_Is_automatic(CORE_barrier_Attributes *the_attribute)
Checks if the barrier is automatic.