1 | /* thread.inl |
---|
2 | * |
---|
3 | * This file contains the macro implementation of the inlined |
---|
4 | * routines from the Thread handler. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989-1997. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * Copyright assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may in |
---|
11 | * the file LICENSE in this distribution or at |
---|
12 | * http://www.OARcorp.com/rtems/license.html. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef __THREAD_inl |
---|
18 | #define __THREAD_inl |
---|
19 | |
---|
20 | /*PAGE |
---|
21 | * |
---|
22 | * _Thread_Stop_multitasking |
---|
23 | * |
---|
24 | */ |
---|
25 | |
---|
26 | #define _Thread_Stop_multitasking() \ |
---|
27 | _Context_Switch( &_Thread_Executing->Registers, &_Thread_BSP_context ); |
---|
28 | |
---|
29 | /*PAGE |
---|
30 | * |
---|
31 | * _Thread_Is_executing |
---|
32 | * |
---|
33 | */ |
---|
34 | |
---|
35 | #define _Thread_Is_executing( _the_thread ) \ |
---|
36 | ( (_the_thread) == _Thread_Executing ) |
---|
37 | |
---|
38 | /*PAGE |
---|
39 | * |
---|
40 | * _Thread_Is_heir |
---|
41 | * |
---|
42 | */ |
---|
43 | |
---|
44 | #define _Thread_Is_heir( _the_thread ) \ |
---|
45 | ( (_the_thread) == _Thread_Heir ) |
---|
46 | |
---|
47 | /*PAGE |
---|
48 | * |
---|
49 | * _Thread_Is_executing_also_the_heir |
---|
50 | * |
---|
51 | */ |
---|
52 | |
---|
53 | #define _Thread_Is_executing_also_the_heir() \ |
---|
54 | ( _Thread_Executing == _Thread_Heir ) |
---|
55 | |
---|
56 | /*PAGE |
---|
57 | * |
---|
58 | * _Thread_Resume |
---|
59 | * |
---|
60 | */ |
---|
61 | |
---|
62 | #define _Thread_Resume( _the_thread ) \ |
---|
63 | _Thread_Clear_state( (_the_thread), STATES_SUSPENDED ) |
---|
64 | |
---|
65 | /*PAGE |
---|
66 | * |
---|
67 | * _Thread_Unblock |
---|
68 | * |
---|
69 | */ |
---|
70 | |
---|
71 | #define _Thread_Unblock( _the_thread ) \ |
---|
72 | _Thread_Clear_state( (_the_thread), STATES_BLOCKED ); |
---|
73 | |
---|
74 | /*PAGE |
---|
75 | * |
---|
76 | * _Thread_Restart_self |
---|
77 | * |
---|
78 | */ |
---|
79 | |
---|
80 | #define _Thread_Restart_self() \ |
---|
81 | { \ |
---|
82 | if ( _Thread_Executing->fp_context != NULL ) \ |
---|
83 | _Context_Restore_fp( &_Thread_Executing->fp_context ); \ |
---|
84 | \ |
---|
85 | _CPU_Context_Restart_self( &_Thread_Executing->Registers ); \ |
---|
86 | } |
---|
87 | |
---|
88 | /*PAGE |
---|
89 | * |
---|
90 | * _Thread_Calculate_heir |
---|
91 | * |
---|
92 | */ |
---|
93 | |
---|
94 | #define _Thread_Calculate_heir() \ |
---|
95 | { \ |
---|
96 | Priority_Control highest; \ |
---|
97 | \ |
---|
98 | _Priority_Get_highest( highest ); \ |
---|
99 | \ |
---|
100 | _Thread_Heir = (Thread_Control *) _Thread_Ready_chain[ highest ].first; \ |
---|
101 | } |
---|
102 | |
---|
103 | /*PAGE |
---|
104 | * |
---|
105 | * _Thread_Is_allocated_fp |
---|
106 | * |
---|
107 | */ |
---|
108 | |
---|
109 | #define _Thread_Is_allocated_fp( _the_thread ) \ |
---|
110 | ( (_the_thread) == _Thread_Allocated_fp ) |
---|
111 | |
---|
112 | /*PAGE |
---|
113 | * |
---|
114 | * _Thread_Deallocate_fp |
---|
115 | * |
---|
116 | */ |
---|
117 | |
---|
118 | #define _Thread_Deallocate_fp() \ |
---|
119 | _Thread_Allocated_fp = NULL |
---|
120 | |
---|
121 | /*PAGE |
---|
122 | * |
---|
123 | * _Thread_Disable_dispatch |
---|
124 | * |
---|
125 | */ |
---|
126 | |
---|
127 | #define _Thread_Disable_dispatch() \ |
---|
128 | _Thread_Dispatch_disable_level += 1 |
---|
129 | |
---|
130 | /*PAGE |
---|
131 | * |
---|
132 | * _Thread_Enable_dispatch |
---|
133 | * |
---|
134 | */ |
---|
135 | |
---|
136 | #if ( CPU_INLINE_ENABLE_DISPATCH == TRUE ) |
---|
137 | #define _Thread_Enable_dispatch() \ |
---|
138 | { if ( (--_Thread_Dispatch_disable_level) == 0 ) \ |
---|
139 | _Thread_Dispatch(); \ |
---|
140 | } |
---|
141 | #endif |
---|
142 | |
---|
143 | #if ( CPU_INLINE_ENABLE_DISPATCH == FALSE ) |
---|
144 | void _Thread_Enable_dispatch( void ); |
---|
145 | #endif |
---|
146 | |
---|
147 | /*PAGE |
---|
148 | * |
---|
149 | * _Thread_Unnest_dispatch |
---|
150 | * |
---|
151 | */ |
---|
152 | |
---|
153 | #define _Thread_Unnest_dispatch() \ |
---|
154 | _Thread_Dispatch_disable_level -= 1 |
---|
155 | |
---|
156 | /*PAGE |
---|
157 | * |
---|
158 | * _Thread_Is_dispatching_enabled |
---|
159 | * |
---|
160 | */ |
---|
161 | |
---|
162 | #define _Thread_Is_dispatching_enabled() \ |
---|
163 | ( _Thread_Dispatch_disable_level == 0 ) |
---|
164 | |
---|
165 | /*PAGE |
---|
166 | * |
---|
167 | * _Thread_Is_context_switch_necessary |
---|
168 | * |
---|
169 | */ |
---|
170 | |
---|
171 | #define _Thread_Is_context_switch_necessary() \ |
---|
172 | ( _Context_Switch_necessary == TRUE ) |
---|
173 | |
---|
174 | /*PAGE |
---|
175 | * |
---|
176 | * _Thread_Dispatch_initialization |
---|
177 | * |
---|
178 | */ |
---|
179 | |
---|
180 | #define _Thread_Dispatch_initialization() \ |
---|
181 | _Thread_Dispatch_disable_level = 1 |
---|
182 | |
---|
183 | /*PAGE |
---|
184 | * |
---|
185 | * _Thread_Is_null |
---|
186 | * |
---|
187 | */ |
---|
188 | |
---|
189 | #define _Thread_Is_null( _the_thread ) \ |
---|
190 | ( (_the_thread) == NULL ) |
---|
191 | |
---|
192 | /* |
---|
193 | * _Thread_Is_proxy_blocking |
---|
194 | * |
---|
195 | */ |
---|
196 | |
---|
197 | #define _Thread_Is_proxy_blocking( _code ) \ |
---|
198 | ( (_code) == THREAD_STATUS_PROXY_BLOCKING ) |
---|
199 | |
---|
200 | /* |
---|
201 | * _Thread_Internal_allocate |
---|
202 | * |
---|
203 | */ |
---|
204 | |
---|
205 | #define _Thread_Internal_allocate() \ |
---|
206 | ((Thread_Control *) _Objects_Allocate( &_Thread_Internal_information )) |
---|
207 | |
---|
208 | /* |
---|
209 | * _Thread_Internal_free |
---|
210 | * |
---|
211 | */ |
---|
212 | |
---|
213 | #define _Thread_Internal_free( _the_task ) \ |
---|
214 | _Objects_Free( &_Thread_Internal_information, &(_the_task)->Object ) |
---|
215 | |
---|
216 | #endif |
---|
217 | /* end of include file */ |
---|