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