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 | * _Thread_queue_Dequeue |
---|
41 | * |
---|
42 | * DESCRIPTION: |
---|
43 | * |
---|
44 | * This function returns a pointer to a thread waiting on |
---|
45 | * the_thread_queue. The selection of this thread is based on |
---|
46 | * the discipline of the_thread_queue. If no threads are waiting |
---|
47 | * on the_thread_queue, then NULL is returned. |
---|
48 | */ |
---|
49 | |
---|
50 | Thread_Control *_Thread_queue_Dequeue( |
---|
51 | Thread_queue_Control *the_thread_queue |
---|
52 | ); |
---|
53 | |
---|
54 | /* |
---|
55 | * _Thread_queue_Enqueue |
---|
56 | * |
---|
57 | * DESCRIPTION: |
---|
58 | * |
---|
59 | * This routine enqueues the currently executing thread on |
---|
60 | * the_thread_queue with an optional timeout. |
---|
61 | */ |
---|
62 | |
---|
63 | void _Thread_queue_Enqueue( |
---|
64 | Thread_queue_Control *the_thread_queue, |
---|
65 | rtems_interval timeout |
---|
66 | ); |
---|
67 | |
---|
68 | /* |
---|
69 | * _Thread_queue_Extract |
---|
70 | * |
---|
71 | * DESCRIPTION: |
---|
72 | * |
---|
73 | * This routine removes the_thread from the_thread_queue |
---|
74 | * and cancels any timeouts associated with this blocking. |
---|
75 | */ |
---|
76 | |
---|
77 | void _Thread_queue_Extract( |
---|
78 | Thread_queue_Control *the_thread_queue, |
---|
79 | Thread_Control *the_thread |
---|
80 | ); |
---|
81 | |
---|
82 | /* |
---|
83 | * _Thread_queue_First |
---|
84 | * |
---|
85 | * DESCRIPTION: |
---|
86 | * |
---|
87 | * This function returns a pointer to the "first" thread |
---|
88 | * on the_thread_queue. The "first" thread is selected |
---|
89 | * based on the discipline of the_thread_queue. |
---|
90 | */ |
---|
91 | |
---|
92 | Thread_Control *_Thread_queue_First( |
---|
93 | Thread_queue_Control *the_thread_queue |
---|
94 | ); |
---|
95 | |
---|
96 | /* |
---|
97 | * _Thread_queue_Flush |
---|
98 | * |
---|
99 | * DESCRIPTION: |
---|
100 | * |
---|
101 | * This routine unblocks all threads blocked on the_thread_queue |
---|
102 | * and cancels any associated timeouts. |
---|
103 | */ |
---|
104 | |
---|
105 | void _Thread_queue_Flush( |
---|
106 | Thread_queue_Control *the_thread_queue, |
---|
107 | Thread_queue_Flush_callout remote_extract_callout |
---|
108 | ); |
---|
109 | |
---|
110 | /* |
---|
111 | * _Thread_queue_Initialize |
---|
112 | * |
---|
113 | * DESCRIPTION: |
---|
114 | * |
---|
115 | * This routine initializes the_thread_queue based on the |
---|
116 | * discipline indicated in attribute_set. The state set on |
---|
117 | * threads which block on the_thread_queue is state. |
---|
118 | */ |
---|
119 | |
---|
120 | void _Thread_queue_Initialize( |
---|
121 | Thread_queue_Control *the_thread_queue, |
---|
122 | rtems_attribute attribute_set, |
---|
123 | States_Control state |
---|
124 | ); |
---|
125 | |
---|
126 | /* |
---|
127 | * _Thread_queue_Dequeue_priority |
---|
128 | * |
---|
129 | * DESCRIPTION: |
---|
130 | * |
---|
131 | * This function returns a pointer to the highest priority |
---|
132 | * thread waiting on the_thread_queue. If no threads are waiting |
---|
133 | * on the_thread_queue, then NULL is returned. |
---|
134 | */ |
---|
135 | |
---|
136 | Thread_Control *_Thread_queue_Dequeue_priority( |
---|
137 | Thread_queue_Control *the_thread_queue |
---|
138 | ); |
---|
139 | |
---|
140 | /* |
---|
141 | * _Thread_queue_Enqueue_priority |
---|
142 | * |
---|
143 | * DESCRIPTION: |
---|
144 | * |
---|
145 | * This routine enqueues the currently executing thread on |
---|
146 | * the_thread_queue with an optional timeout using the |
---|
147 | * priority discipline. |
---|
148 | */ |
---|
149 | |
---|
150 | void _Thread_queue_Enqueue_priority( |
---|
151 | Thread_queue_Control *the_thread_queue, |
---|
152 | Thread_Control *the_thread, |
---|
153 | rtems_interval timeout |
---|
154 | ); |
---|
155 | |
---|
156 | /* |
---|
157 | * _Thread_queue_Extract_priority |
---|
158 | * |
---|
159 | * DESCRIPTION: |
---|
160 | * |
---|
161 | * This routine removes the_thread from the_thread_queue |
---|
162 | * and cancels any timeouts associated with this blocking. |
---|
163 | */ |
---|
164 | |
---|
165 | void _Thread_queue_Extract_priority( |
---|
166 | Thread_queue_Control *the_thread_queue, |
---|
167 | Thread_Control *the_thread |
---|
168 | ); |
---|
169 | |
---|
170 | /* |
---|
171 | * _Thread_queue_First_priority |
---|
172 | * |
---|
173 | * DESCRIPTION: |
---|
174 | * |
---|
175 | * This function returns a pointer to the "first" thread |
---|
176 | * on the_thread_queue. The "first" thread is the highest |
---|
177 | * priority thread waiting on the_thread_queue. |
---|
178 | */ |
---|
179 | |
---|
180 | Thread_Control *_Thread_queue_First_priority( |
---|
181 | Thread_queue_Control *the_thread_queue |
---|
182 | ); |
---|
183 | |
---|
184 | /* |
---|
185 | * _Thread_queue_Dequeue_FIFO |
---|
186 | * |
---|
187 | * DESCRIPTION: |
---|
188 | * |
---|
189 | * This function returns a pointer to the thread which has |
---|
190 | * been waiting the longest on the_thread_queue. If no |
---|
191 | * threads are waiting on the_thread_queue, then NULL is returned. |
---|
192 | */ |
---|
193 | |
---|
194 | Thread_Control *_Thread_queue_Dequeue_fifo( |
---|
195 | Thread_queue_Control *the_thread_queue |
---|
196 | ); |
---|
197 | |
---|
198 | /* |
---|
199 | * _Thread_queue_Enqueue_FIFO |
---|
200 | * |
---|
201 | * DESCRIPTION: |
---|
202 | * |
---|
203 | * This routine enqueues the currently executing thread on |
---|
204 | * the_thread_queue with an optional timeout using the |
---|
205 | * RTEMS_FIFO discipline. |
---|
206 | */ |
---|
207 | |
---|
208 | void _Thread_queue_Enqueue_fifo( |
---|
209 | Thread_queue_Control *the_thread_queue, |
---|
210 | Thread_Control *the_thread, |
---|
211 | rtems_interval timeout |
---|
212 | ); |
---|
213 | |
---|
214 | /* |
---|
215 | * _Thread_queue_Extract_FIFO |
---|
216 | * |
---|
217 | * DESCRIPTION: |
---|
218 | * |
---|
219 | * This routine removes the_thread from the_thread_queue |
---|
220 | * and cancels any timeouts associated with this blocking. |
---|
221 | */ |
---|
222 | |
---|
223 | void _Thread_queue_Extract_fifo( |
---|
224 | Thread_queue_Control *the_thread_queue, |
---|
225 | Thread_Control *the_thread |
---|
226 | ); |
---|
227 | |
---|
228 | /* |
---|
229 | * _Thread_queue_First_FIFO |
---|
230 | * |
---|
231 | * DESCRIPTION: |
---|
232 | * |
---|
233 | * This function returns a pointer to the "first" thread |
---|
234 | * on the_thread_queue. The first thread is the thread |
---|
235 | * which has been waiting longest on the_thread_queue. |
---|
236 | */ |
---|
237 | |
---|
238 | Thread_Control *_Thread_queue_First_fifo( |
---|
239 | Thread_queue_Control *the_thread_queue |
---|
240 | ); |
---|
241 | |
---|
242 | /* |
---|
243 | * _Thread_queue_timeout |
---|
244 | * |
---|
245 | * DESCRIPTION: |
---|
246 | * |
---|
247 | * This routine is invoked when a task's request has not |
---|
248 | * been satisfied after the timeout interval specified to |
---|
249 | * enqueue. The task represented by ID will be unblocked and |
---|
250 | * its status code will be set in it's control block to indicate |
---|
251 | * that a timeout has occurred. |
---|
252 | */ |
---|
253 | |
---|
254 | void _Thread_queue_Timeout ( |
---|
255 | Objects_Id id, |
---|
256 | void *ignored |
---|
257 | ); |
---|
258 | |
---|
259 | #ifdef __cplusplus |
---|
260 | } |
---|
261 | #endif |
---|
262 | |
---|
263 | #endif |
---|
264 | /* end of include file */ |
---|