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

4.104.114.84.95
Last change on this file since a85d8ec was ef9505a9, checked in by Joel Sherrill <joel.sherrill@…>, on 07/01/02 at 22:30:12

2002-07-01 Joel Sherrill <joel@…>

  • Mega patch merge to change the format of the object IDs to loosen the dependency between the SCORE and the various APIs. There was considerable work to simplify the object name management and it appears that the name_table field is no longer needed. This patch also includes the addition of the internal mutex which is currently only used to protect some types of allocation and deallocation. This significantly can reduce context switch latency under certain circumstances. In particular, some heap/region operations were O(n) and had dispatching disabled. This should help enormously. With this merge, the patch is not as clean as it should be. In particular, the documentation has not been modified to reflect the new object ID layout, the IDs in the test screens are not updated, and _Objects_Get_information needs to be a real routine not inlined. As part of this patch a lot of MP code for thread/proxy blocking was made conditional and cleaned up.
  • include/Makefile.am, include/rtems/score/coremsg.h, include/rtems/score/coremutex.h, include/rtems/score/coresem.h, include/rtems/score/object.h, include/rtems/score/threadq.h, inline/rtems/score/object.inl, inline/rtems/score/thread.inl, macros/rtems/score/object.inl, src/Makefile.am, src/coremsg.c, src/coremutex.c, src/coresem.c, src/mpci.c, src/objectcomparenameraw.c, src/objectextendinformation.c, src/objectinitializeinformation.c, src/objectnametoid.c, src/thread.c, src/threadclose.c, src/threadget.c, src/threadq.c, src/threadqextractwithproxy.c: Modified as part of above.
  • include/rtems/score/apimutex.h, src/objectgetnoprotection.c: New files.
  • Property mode set to 100644
File size: 6.6 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-1999.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
12 *
13 *  $Id$
14 */
15
16#ifndef __THREAD_QUEUE_h
17#define __THREAD_QUEUE_h
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23#include <rtems/score/tqdata.h>
24
25#include <rtems/score/object.h>
26#include <rtems/score/thread.h>
27#include <rtems/score/watchdog.h>
28
29/*
30 *  Constant for indefinite wait.
31 */
32 
33#define THREAD_QUEUE_WAIT_FOREVER  WATCHDOG_NO_TIMEOUT
34
35/*
36 *  The following type defines the callout used when a remote task
37 *  is extracted from a local thread queue.
38 */
39
40typedef void ( *Thread_queue_Flush_callout )(
41                 Thread_Control *
42             );
43
44/*
45 *  The following type defines the callout used when a local task
46 *  is extracted from a remote thread queue (i.e. it's proxy must
47 *  extracted from the remote queue).
48 */
49 
50#if 0
51typedef void ( *Thread_queue_Extract_callout )(
52                 Thread_Control *
53             );
54
55SCORE_EXTERN Thread_queue_Extract_callout 
56  _Thread_queue_Extract_table[ OBJECTS_CLASSES_LAST + 1 ];
57#endif
58
59/*
60 *  _Thread_queue_Dequeue
61 *
62 *  DESCRIPTION:
63 *
64 *  This function returns a pointer to a thread waiting on
65 *  the_thread_queue.  The selection of this thread is based on
66 *  the discipline of the_thread_queue.  If no threads are waiting
67 *  on the_thread_queue, then NULL is returned.
68 */
69
70Thread_Control *_Thread_queue_Dequeue(
71  Thread_queue_Control *the_thread_queue
72);
73
74/*
75 *  _Thread_queue_Enqueue
76 *
77 *  DESCRIPTION:
78 *
79 *  This routine enqueues the currently executing thread on
80 *  the_thread_queue with an optional timeout.
81 */
82
83void _Thread_queue_Enqueue(
84  Thread_queue_Control *the_thread_queue,
85  Watchdog_Interval     timeout
86);
87
88/*
89 *  _Thread_queue_Extract
90 *
91 *  DESCRIPTION:
92 *
93 *  This routine removes the_thread from the_thread_queue
94 *  and cancels any timeouts associated with this blocking.
95 */
96
97void _Thread_queue_Extract(
98  Thread_queue_Control *the_thread_queue,
99  Thread_Control       *the_thread
100);
101
102/*
103 *  _Thread_queue_Extract_with_proxy
104 *
105 *  DESCRIPTION:
106 *
107 *  This routine extracts the_thread from the_thread_queue
108 *  and ensures that if there is a proxy for this task on
109 *  another node, it is also dealt with.
110 */
111 
112boolean _Thread_queue_Extract_with_proxy(
113  Thread_Control       *the_thread
114);
115
116/*
117 *  _Thread_queue_First
118 *
119 *  DESCRIPTION:
120 *
121 *  This function returns a pointer to the "first" thread
122 *  on the_thread_queue.  The "first" thread is selected
123 *  based on the discipline of the_thread_queue.
124 */
125
126Thread_Control *_Thread_queue_First(
127  Thread_queue_Control *the_thread_queue
128);
129
130/*
131 *  _Thread_queue_Flush
132 *
133 *  DESCRIPTION:
134 *
135 *  This routine unblocks all threads blocked on the_thread_queue
136 *  and cancels any associated timeouts.
137 */
138
139void _Thread_queue_Flush(
140  Thread_queue_Control       *the_thread_queue,
141  Thread_queue_Flush_callout  remote_extract_callout,
142  unsigned32                  status
143);
144
145/*
146 *  _Thread_queue_Initialize
147 *
148 *  DESCRIPTION:
149 *
150 *  This routine initializes the_thread_queue based on the
151 *  discipline indicated in attribute_set.  The state set on
152 *  threads which block on the_thread_queue is state.
153 */
154
155void _Thread_queue_Initialize(
156  Thread_queue_Control         *the_thread_queue,
157  Thread_queue_Disciplines      the_discipline,
158  States_Control                state,
159  unsigned32                    timeout_status
160);
161
162/*
163 *  _Thread_queue_Dequeue_priority
164 *
165 *  DESCRIPTION:
166 *
167 *  This function returns a pointer to the highest priority
168 *  thread waiting on the_thread_queue.  If no threads are waiting
169 *  on the_thread_queue, then NULL is returned.
170 */
171
172Thread_Control *_Thread_queue_Dequeue_priority(
173  Thread_queue_Control *the_thread_queue
174);
175
176/*
177 *  _Thread_queue_Enqueue_priority
178 *
179 *  DESCRIPTION:
180 *
181 *  This routine enqueues the currently executing thread on
182 *  the_thread_queue with an optional timeout using the
183 *  priority discipline.
184 */
185
186void _Thread_queue_Enqueue_priority(
187  Thread_queue_Control *the_thread_queue,
188  Thread_Control       *the_thread,
189  Watchdog_Interval     timeout
190);
191
192/*
193 *  _Thread_queue_Extract_priority
194 *
195 *  DESCRIPTION:
196 *
197 *  This routine removes the_thread from the_thread_queue
198 *  and cancels any timeouts associated with this blocking.
199 */
200
201void _Thread_queue_Extract_priority(
202  Thread_queue_Control *the_thread_queue,
203  Thread_Control       *the_thread
204);
205
206/*
207 *  _Thread_queue_First_priority
208 *
209 *  DESCRIPTION:
210 *
211 *  This function returns a pointer to the "first" thread
212 *  on the_thread_queue.  The "first" thread is the highest
213 *  priority thread waiting on the_thread_queue.
214 */
215
216Thread_Control *_Thread_queue_First_priority(
217  Thread_queue_Control *the_thread_queue
218);
219
220/*
221 *  _Thread_queue_Dequeue_FIFO
222 *
223 *  DESCRIPTION:
224 *
225 *  This function returns a pointer to the thread which has
226 *  been waiting the longest on  the_thread_queue.  If no
227 *  threads are waiting on the_thread_queue, then NULL is returned.
228 */
229
230Thread_Control *_Thread_queue_Dequeue_fifo(
231  Thread_queue_Control *the_thread_queue
232);
233
234/*
235 *  _Thread_queue_Enqueue_FIFO
236 *
237 *  DESCRIPTION:
238 *
239 *  This routine enqueues the currently executing thread on
240 *  the_thread_queue with an optional timeout using the
241 *  FIFO discipline.
242 */
243
244void _Thread_queue_Enqueue_fifo(
245  Thread_queue_Control *the_thread_queue,
246  Thread_Control       *the_thread,
247  Watchdog_Interval     timeout
248);
249
250/*
251 *  _Thread_queue_Extract_FIFO
252 *
253 *  DESCRIPTION:
254 *
255 *  This routine removes the_thread from the_thread_queue
256 *  and cancels any timeouts associated with this blocking.
257 */
258
259void _Thread_queue_Extract_fifo(
260  Thread_queue_Control *the_thread_queue,
261  Thread_Control       *the_thread
262);
263
264/*
265 *  _Thread_queue_First_FIFO
266 *
267 *  DESCRIPTION:
268 *
269 *  This function returns a pointer to the "first" thread
270 *  on the_thread_queue.  The first thread is the thread
271 *  which has been waiting longest on the_thread_queue.
272 */
273
274Thread_Control *_Thread_queue_First_fifo(
275  Thread_queue_Control *the_thread_queue
276);
277
278/*
279 *  _Thread_queue_timeout
280 *
281 *  DESCRIPTION:
282 *
283 *  This routine is invoked when a task's request has not
284 *  been satisfied after the timeout interval specified to
285 *  enqueue.  The task represented by ID will be unblocked and
286 *  its status code will be set in it's control block to indicate
287 *  that a timeout has occurred.
288 */
289
290void _Thread_queue_Timeout (
291  Objects_Id  id,
292  void       *ignored
293);
294
295#ifdef __cplusplus
296}
297#endif
298
299#endif
300/* end of include file */
Note: See TracBrowser for help on using the repository browser.