source: rtems/cpukit/score/include/rtems/score/threadq.h @ bf54252

4.115
Last change on this file since bf54252 was bf54252, checked in by Alexandre Devienne <deviennealexandre@…>, on 11/28/12 at 20:14:50

Score misc: Clean up Doxygen #4 (GCI 2012)

This patch is a task from GCI 2012 which improves the Doxygen
comments in the RTEMS source.

http://www.google-melange.com/gci/task/view/google/gci2012/7985215

  • Property mode set to 100644
File size: 9.1 KB
Line 
1/**
2 *  @file  rtems/score/threadq.h
3 *
4 *  This include file contains all the constants and structures associated
5 *  with the manipulation of objects.
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2009.
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#ifndef _RTEMS_SCORE_THREADQ_H
18#define _RTEMS_SCORE_THREADQ_H
19
20/**
21 *  @defgroup ScoreThreadQ Thread Queue Handler
22 *
23 *  @ingroup Score
24 *
25 *  This handler encapsulates functionality related to managing sets of threads
26 *  blocked waiting for resources.
27 */
28/**@{*/
29
30#include <rtems/score/tqdata.h>
31
32#include <rtems/score/object.h>
33#include <rtems/score/thread.h>
34#include <rtems/score/watchdog.h>
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40/**
41 *  Constant for indefinite wait.
42 */
43#define THREAD_QUEUE_WAIT_FOREVER  WATCHDOG_NO_TIMEOUT
44
45/**
46 *  The following type defines the callout used when a remote task
47 *  is extracted from a local thread queue.
48 */
49typedef void ( *Thread_queue_Flush_callout )(
50                  Thread_Control *
51             );
52
53/**
54 *  The following type defines the callout used for timeout processing
55 *  methods.
56 */
57typedef void ( *Thread_queue_Timeout_callout )(
58                 Objects_Id,
59                 void *
60             );
61
62/**
63 *  @brief Thread Queue Dequeue
64 *
65 *  This function returns a pointer to a thread waiting on
66 *  the_thread_queue.  The selection of this thread is based on
67 *  the discipline of the_thread_queue.  If no threads are waiting
68 *  on the_thread_queue, then NULL is returned.
69 */
70Thread_Control *_Thread_queue_Dequeue(
71  Thread_queue_Control *the_thread_queue
72);
73
74/**
75 *  @brief Thread Queue Enqueue Wrapper
76 *
77 *  This routine enqueues the currently executing thread on
78 *  the_thread_queue with an optional timeout.
79 */
80#define _Thread_queue_Enqueue( _the_thread_queue, _timeout ) \
81  _Thread_queue_Enqueue_with_handler( \
82    _the_thread_queue, \
83    _timeout, \
84    _Thread_queue_Timeout )
85
86/**
87 *  @brief Thread Queue Enqueue
88 *
89 *  This routine blocks a thread, places it on a thread, and optionally
90 *  starts a timeout timer.
91 *
92 *  @param[in] the_thread_queue pointer to threadq
93 *  @param[in] timeout interval to wait
94 *
95 *  - INTERRUPT LATENCY:
96 *    + single case
97 */
98void _Thread_queue_Enqueue_with_handler(
99  Thread_queue_Control*        the_thread_queue,
100  Watchdog_Interval            timeout,
101  Thread_queue_Timeout_callout handler
102);
103
104/**
105 *  @brief Thread Queue Requeue
106 *
107 *  This routine is invoked when a thread changes priority and is
108 *  blocked on a thread queue.  If the queue is priority ordered,
109 *  the_thread is removed from the_thread_queue and reinserted using
110 *  its new priority.  This method has no impact on the state of the_thread
111 *  or of any timeouts associated with this blocking.
112 *
113 *  @param[in] the_thread_queue pointer to a threadq header
114 *  @param[in] the_thread pointer to a thread control block
115 */
116void _Thread_queue_Requeue(
117  Thread_queue_Control *the_thread_queue,
118  Thread_Control       *the_thread
119);
120
121/**
122 *  @brief Thread Queue Extract
123 *
124 *  This routine removes the_thread from the_thread_queue
125 *  and cancels any timeouts associated with this blocking.
126 */
127void _Thread_queue_Extract(
128  Thread_queue_Control *the_thread_queue,
129  Thread_Control       *the_thread
130);
131
132/**
133 *  @brief Thread Queue Extract with proxy
134 *
135 *  This routine extracts the_thread from the_thread_queue
136 *  and ensures that if there is a proxy for this task on
137 *  another node, it is also dealt with.
138 */
139bool _Thread_queue_Extract_with_proxy(
140  Thread_Control       *the_thread
141);
142
143/**
144 *  @brief Thread Queue First
145 *
146 *  This function returns a pointer to the "first" thread
147 *  on the_thread_queue.  The "first" thread is selected
148 *  based on the discipline of the_thread_queue.
149 */
150Thread_Control *_Thread_queue_First(
151  Thread_queue_Control *the_thread_queue
152);
153
154/**
155 *  @brief Thread Queue Flush
156 *
157 *  This routine unblocks all threads blocked on the_thread_queue
158 *  and cancels any associated timeouts.
159 */
160void _Thread_queue_Flush(
161  Thread_queue_Control       *the_thread_queue,
162  Thread_queue_Flush_callout  remote_extract_callout,
163  uint32_t                    status
164);
165
166/**
167 *  @brief Thread Queue Initialize
168 *
169 *  This routine initializes the_thread_queue based on the
170 *  discipline indicated in attribute_set.  The state set on
171 *  threads which block on the_thread_queue is state.
172 */
173void _Thread_queue_Initialize(
174  Thread_queue_Control         *the_thread_queue,
175  Thread_queue_Disciplines      the_discipline,
176  States_Control                state,
177  uint32_t                      timeout_status
178);
179
180/**
181 *  @brief Thread Queue Dequeue priority
182 *
183 *  This routine removes a thread from the specified PRIORITY based
184 *  threadq, unblocks it, and cancels its timeout timer.
185 *
186 *  - INTERRUPT LATENCY:
187 *    + single case
188 *
189 * @param[in] the_thread_queue is a pointer to a thread queue
190 *
191 * @retval thread dequeued
192 * @retval NULL if no thread are waiting on the_thread_queue
193 */
194Thread_Control *_Thread_queue_Dequeue_priority(
195  Thread_queue_Control *the_thread_queue
196);
197
198/**
199 *  @brief Thread Queue Enqueue priority
200 *
201 *  This routine enqueues the currently executing thread on
202 *  the_thread_queue with an optional timeout using the
203 *  priority discipline.
204 */
205Thread_blocking_operation_States _Thread_queue_Enqueue_priority (
206  Thread_queue_Control *the_thread_queue,
207  Thread_Control       *the_thread,
208  ISR_Level            *level_p
209);
210
211/**
212 *  @brief Thread Queue Extract priority Helper
213 *
214 *  This routine removes the_thread from the_thread_queue
215 *  and cancels any timeouts associated with this blocking.
216 *  @param[in] the_thread_queue pointer to a threadq header
217 *  @param[in] the_thread pointer to a thread control block
218 *  @param[in] requeuing true if requeuing and should not alter
219 *         timeout or state
220 *  - INTERRUPT LATENCY:
221 *    + EXTRACT_PRIORITY
222 */
223void _Thread_queue_Extract_priority_helper(
224  Thread_queue_Control *the_thread_queue,
225  Thread_Control       *the_thread,
226  bool                  requeuing
227);
228
229/**
230 *  @brief Thread Queue Extract priority
231 *
232 * This macro wraps the underlying call and hides the requeuing argument.
233 */
234
235#define _Thread_queue_Extract_priority( _the_thread_queue, _the_thread ) \
236  _Thread_queue_Extract_priority_helper( _the_thread_queue, _the_thread, false )
237
238
239/**
240 *  @brief Thread Queue First priority
241 *
242 *  This function returns a pointer to the "first" thread
243 *  on the_thread_queue.  The "first" thread is the highest
244 *  priority thread waiting on the_thread_queue.
245 */
246Thread_Control *_Thread_queue_First_priority(
247  Thread_queue_Control *the_thread_queue
248);
249
250/**
251 *  @brief Thread Queue Dequeue FIFO
252 *
253 *  This function returns a pointer to the thread which has
254 *  been waiting the longest on  the_thread_queue.  If no
255 *  threads are waiting on the_thread_queue, then NULL is returned.
256 */
257Thread_Control *_Thread_queue_Dequeue_fifo(
258  Thread_queue_Control *the_thread_queue
259);
260
261/**
262 *  @brief Thread Queue Enqueue FIFO
263 *
264 *  This routine enqueues the currently executing thread on
265 *  the_thread_queue with an optional timeout using the
266 *  FIFO discipline.
267 *
268 *    @param[in] the_thread_queue pointer to threadq
269 *    @param[in] the_thread pointer to the thread to block
270 *    @param[in] level_p interrupt level in case the operation blocks actually
271 *
272 *  - INTERRUPT LATENCY:
273 *    + single case
274 */
275Thread_blocking_operation_States _Thread_queue_Enqueue_fifo (
276  Thread_queue_Control *the_thread_queue,
277  Thread_Control       *the_thread,
278  ISR_Level            *level_p
279);
280
281/**
282 *  @brief Thread Queue Extract FIFO
283 *
284 *  This routine removes the_thread from the_thread_queue
285 *  and cancels any timeouts associated with this blocking.
286 */
287void _Thread_queue_Extract_fifo(
288  Thread_queue_Control *the_thread_queue,
289  Thread_Control       *the_thread
290);
291
292/**
293 *  @brief Thread Queue First FIFO
294 *
295 *  This function returns a pointer to the "first" thread
296 *  on the_thread_queue.  The first thread is the thread
297 *  which has been waiting longest on the_thread_queue.
298 */
299Thread_Control *_Thread_queue_First_fifo(
300  Thread_queue_Control *the_thread_queue
301);
302
303/**
304 *  @brief Thread Queue timeout
305 *
306 *  This routine is invoked when a task's request has not
307 *  been satisfied after the timeout interval specified to
308 *  enqueue.  The task represented by ID will be unblocked and
309 *  its status code will be set in it's control block to indicate
310 *  that a timeout has occurred.
311 */
312void _Thread_queue_Timeout (
313  Objects_Id  id,
314  void       *ignored
315);
316
317/**
318 *  @brief Process Thread Queue Timeout
319 *
320 * This is a shared helper routine which makes it easier to have multiple
321 * object class specific timeout routines.
322 *
323 * @param[in] the_thread is the thread to extract
324 *
325 * @note This method assumes thread dispatching is disabled
326 *       and is expected to be called via the processing of
327 *       a clock tick.
328 */
329void _Thread_queue_Process_timeout(
330  Thread_Control *the_thread
331);
332
333#ifndef __RTEMS_APPLICATION__
334#include <rtems/score/threadq.inl>
335#endif
336
337#ifdef __cplusplus
338}
339#endif
340
341/**@}*/
342
343#endif
344/* end of include file */
Note: See TracBrowser for help on using the repository browser.