source: rtems/c/src/exec/score/headers/threadq.h @ eb5a7e07

4.104.114.84.95
Last change on this file since eb5a7e07 was 5e9b32b, checked in by Joel Sherrill <joel.sherrill@…>, on 09/26/95 at 19:27:15

posix support initially added

  • Property mode set to 100644
File size: 6.8 KB
Line 
1/*  threadq.h
2 *
3 *  This include file contains all the constants and structures associated
4 *  with the manipulation of objects.
5 *
6 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
7 *  On-Line Applications Research Corporation (OAR).
8 *  All rights assigned to U.S. Government, 1994.
9 *
10 *  This material may be reproduced by or for the U.S. Government pursuant
11 *  to the copyright license under the clause at DFARS 252.227-7013.  This
12 *  notice must appear in all copies of this file and its derivatives.
13 *
14 *  $Id$
15 */
16
17#ifndef __THREAD_QUEUE_h
18#define __THREAD_QUEUE_h
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#include <rtems/score/tqdata.h>
25
26#include <rtems/score/object.h>
27#include <rtems/score/thread.h>
28#include <rtems/score/watchdog.h>
29
30/*
31 *  Constant for indefinite wait.
32 */
33 
34#define THREAD_QUEUE_WAIT_FOREVER  WATCHDOG_NO_TIMEOUT
35
36/*
37 *  The following type defines the callout used when a remote task
38 *  is extracted from a local thread queue.
39 */
40
41typedef void ( *Thread_queue_Flush_callout )(
42                 Thread_Control *
43             );
44
45/*
46 *  The following type defines the callout used when a local task
47 *  is extracted from a remote thread queue (i.e. it's proxy must
48 *  extracted from the remote queue).
49 */
50 
51typedef void ( *Thread_queue_Extract_callout )(
52                 Thread_Control *
53             );
54
55EXTERN Thread_queue_Extract_callout 
56  _Thread_queue_Extract_table[ OBJECTS_CLASSES_LAST + 1 ];
57
58/*
59 *  _Thread_queue_Dequeue
60 *
61 *  DESCRIPTION:
62 *
63 *  This function returns a pointer to a thread waiting on
64 *  the_thread_queue.  The selection of this thread is based on
65 *  the discipline of the_thread_queue.  If no threads are waiting
66 *  on the_thread_queue, then NULL is returned.
67 */
68
69Thread_Control *_Thread_queue_Dequeue(
70  Thread_queue_Control *the_thread_queue
71);
72
73/*
74 *  _Thread_queue_Enqueue
75 *
76 *  DESCRIPTION:
77 *
78 *  This routine enqueues the currently executing thread on
79 *  the_thread_queue with an optional timeout.
80 */
81
82void _Thread_queue_Enqueue(
83  Thread_queue_Control *the_thread_queue,
84  Watchdog_Interval     timeout
85);
86
87/*
88 *  _Thread_queue_Extract
89 *
90 *  DESCRIPTION:
91 *
92 *  This routine removes the_thread from the_thread_queue
93 *  and cancels any timeouts associated with this blocking.
94 */
95
96void _Thread_queue_Extract(
97  Thread_queue_Control *the_thread_queue,
98  Thread_Control       *the_thread
99);
100
101/*
102 *  _Thread_queue_Extract_with_proxy
103 *
104 *  DESCRIPTION:
105 *
106 *  This routine extracts the_thread from the_thread_queue
107 *  and insures that if there is a proxy for this task on
108 *  another node, it is also dealt with.
109 */
110 
111boolean _Thread_queue_Extract_with_proxy(
112  Thread_Control       *the_thread
113);
114
115/*
116 *  _Thread_queue_First
117 *
118 *  DESCRIPTION:
119 *
120 *  This function returns a pointer to the "first" thread
121 *  on the_thread_queue.  The "first" thread is selected
122 *  based on the discipline of the_thread_queue.
123 */
124
125Thread_Control *_Thread_queue_First(
126  Thread_queue_Control *the_thread_queue
127);
128
129/*
130 *  _Thread_queue_Flush
131 *
132 *  DESCRIPTION:
133 *
134 *  This routine unblocks all threads blocked on the_thread_queue
135 *  and cancels any associated timeouts.
136 */
137
138void _Thread_queue_Flush(
139  Thread_queue_Control       *the_thread_queue,
140  Thread_queue_Flush_callout  remote_extract_callout,
141  unsigned32                  status
142);
143
144/*
145 *  _Thread_queue_Initialize
146 *
147 *  DESCRIPTION:
148 *
149 *  This routine initializes the_thread_queue based on the
150 *  discipline indicated in attribute_set.  The state set on
151 *  threads which block on the_thread_queue is state.
152 */
153
154void _Thread_queue_Initialize(
155  Thread_queue_Control         *the_thread_queue,
156  Objects_Classes               the_class,
157  Thread_queue_Disciplines      the_discipline,
158  States_Control                state,
159  Thread_queue_Extract_callout  proxy_extract_callout,
160  unsigned32                    timeout_status
161);
162
163/*
164 *  _Thread_queue_Dequeue_priority
165 *
166 *  DESCRIPTION:
167 *
168 *  This function returns a pointer to the highest priority
169 *  thread waiting on the_thread_queue.  If no threads are waiting
170 *  on the_thread_queue, then NULL is returned.
171 */
172
173Thread_Control *_Thread_queue_Dequeue_priority(
174  Thread_queue_Control *the_thread_queue
175);
176
177/*
178 *  _Thread_queue_Enqueue_priority
179 *
180 *  DESCRIPTION:
181 *
182 *  This routine enqueues the currently executing thread on
183 *  the_thread_queue with an optional timeout using the
184 *  priority discipline.
185 */
186
187void _Thread_queue_Enqueue_priority(
188  Thread_queue_Control *the_thread_queue,
189  Thread_Control       *the_thread,
190  Watchdog_Interval     timeout
191);
192
193/*
194 *  _Thread_queue_Extract_priority
195 *
196 *  DESCRIPTION:
197 *
198 *  This routine removes the_thread from the_thread_queue
199 *  and cancels any timeouts associated with this blocking.
200 */
201
202void _Thread_queue_Extract_priority(
203  Thread_queue_Control *the_thread_queue,
204  Thread_Control       *the_thread
205);
206
207/*
208 *  _Thread_queue_First_priority
209 *
210 *  DESCRIPTION:
211 *
212 *  This function returns a pointer to the "first" thread
213 *  on the_thread_queue.  The "first" thread is the highest
214 *  priority thread waiting on the_thread_queue.
215 */
216
217Thread_Control *_Thread_queue_First_priority(
218  Thread_queue_Control *the_thread_queue
219);
220
221/*
222 *  _Thread_queue_Dequeue_FIFO
223 *
224 *  DESCRIPTION:
225 *
226 *  This function returns a pointer to the thread which has
227 *  been waiting the longest on  the_thread_queue.  If no
228 *  threads are waiting on the_thread_queue, then NULL is returned.
229 */
230
231Thread_Control *_Thread_queue_Dequeue_fifo(
232  Thread_queue_Control *the_thread_queue
233);
234
235/*
236 *  _Thread_queue_Enqueue_FIFO
237 *
238 *  DESCRIPTION:
239 *
240 *  This routine enqueues the currently executing thread on
241 *  the_thread_queue with an optional timeout using the
242 *  FIFO discipline.
243 */
244
245void _Thread_queue_Enqueue_fifo(
246  Thread_queue_Control *the_thread_queue,
247  Thread_Control       *the_thread,
248  Watchdog_Interval     timeout
249);
250
251/*
252 *  _Thread_queue_Extract_FIFO
253 *
254 *  DESCRIPTION:
255 *
256 *  This routine removes the_thread from the_thread_queue
257 *  and cancels any timeouts associated with this blocking.
258 */
259
260void _Thread_queue_Extract_fifo(
261  Thread_queue_Control *the_thread_queue,
262  Thread_Control       *the_thread
263);
264
265/*
266 *  _Thread_queue_First_FIFO
267 *
268 *  DESCRIPTION:
269 *
270 *  This function returns a pointer to the "first" thread
271 *  on the_thread_queue.  The first thread is the thread
272 *  which has been waiting longest on the_thread_queue.
273 */
274
275Thread_Control *_Thread_queue_First_fifo(
276  Thread_queue_Control *the_thread_queue
277);
278
279/*
280 *  _Thread_queue_timeout
281 *
282 *  DESCRIPTION:
283 *
284 *  This routine is invoked when a task's request has not
285 *  been satisfied after the timeout interval specified to
286 *  enqueue.  The task represented by ID will be unblocked and
287 *  its status code will be set in it's control block to indicate
288 *  that a timeout has occurred.
289 */
290
291void _Thread_queue_Timeout (
292  Objects_Id  id,
293  void       *ignored
294);
295
296#ifdef __cplusplus
297}
298#endif
299
300#endif
301/* end of include file */
Note: See TracBrowser for help on using the repository browser.