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-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_inl |
---|
17 | #define __THREAD_inl |
---|
18 | |
---|
19 | /*PAGE |
---|
20 | * |
---|
21 | * _Thread_Stop_multitasking |
---|
22 | * |
---|
23 | */ |
---|
24 | |
---|
25 | #define _Thread_Stop_multitasking() \ |
---|
26 | _Context_Switch( &_Thread_Executing->Registers, &_Thread_BSP_context ); |
---|
27 | |
---|
28 | /*PAGE |
---|
29 | * |
---|
30 | * _Thread_Is_executing |
---|
31 | * |
---|
32 | */ |
---|
33 | |
---|
34 | #define _Thread_Is_executing( _the_thread ) \ |
---|
35 | ( (_the_thread) == _Thread_Executing ) |
---|
36 | |
---|
37 | /*PAGE |
---|
38 | * |
---|
39 | * _Thread_Is_heir |
---|
40 | * |
---|
41 | */ |
---|
42 | |
---|
43 | #define _Thread_Is_heir( _the_thread ) \ |
---|
44 | ( (_the_thread) == _Thread_Heir ) |
---|
45 | |
---|
46 | /*PAGE |
---|
47 | * |
---|
48 | * _Thread_Is_executing_also_the_heir |
---|
49 | * |
---|
50 | */ |
---|
51 | |
---|
52 | #define _Thread_Is_executing_also_the_heir() \ |
---|
53 | ( _Thread_Executing == _Thread_Heir ) |
---|
54 | |
---|
55 | /*PAGE |
---|
56 | * |
---|
57 | * _Thread_Unblock |
---|
58 | * |
---|
59 | */ |
---|
60 | |
---|
61 | #define _Thread_Unblock( _the_thread ) \ |
---|
62 | _Thread_Clear_state( (_the_thread), STATES_BLOCKED ); |
---|
63 | |
---|
64 | /*PAGE |
---|
65 | * |
---|
66 | * _Thread_Restart_self |
---|
67 | * |
---|
68 | */ |
---|
69 | |
---|
70 | #define _Thread_Restart_self() \ |
---|
71 | { \ |
---|
72 | if ( _Thread_Executing->fp_context != NULL ) \ |
---|
73 | _Context_Restore_fp( &_Thread_Executing->fp_context ); \ |
---|
74 | \ |
---|
75 | _CPU_Context_Restart_self( &_Thread_Executing->Registers ); \ |
---|
76 | } |
---|
77 | |
---|
78 | /*PAGE |
---|
79 | * |
---|
80 | * _Thread_Calculate_heir |
---|
81 | * |
---|
82 | */ |
---|
83 | |
---|
84 | #define _Thread_Calculate_heir() \ |
---|
85 | { \ |
---|
86 | Priority_Control highest; \ |
---|
87 | \ |
---|
88 | _Priority_Get_highest( highest ); \ |
---|
89 | \ |
---|
90 | _Thread_Heir = (Thread_Control *) _Thread_Ready_chain[ highest ].first; \ |
---|
91 | } |
---|
92 | |
---|
93 | /*PAGE |
---|
94 | * |
---|
95 | * _Thread_Is_allocated_fp |
---|
96 | * |
---|
97 | */ |
---|
98 | |
---|
99 | #define _Thread_Is_allocated_fp( _the_thread ) \ |
---|
100 | ( (_the_thread) == _Thread_Allocated_fp ) |
---|
101 | |
---|
102 | /*PAGE |
---|
103 | * |
---|
104 | * _Thread_Deallocate_fp |
---|
105 | * |
---|
106 | */ |
---|
107 | |
---|
108 | #define _Thread_Deallocate_fp() \ |
---|
109 | _Thread_Allocated_fp = NULL |
---|
110 | |
---|
111 | /*PAGE |
---|
112 | * |
---|
113 | * _Thread_Disable_dispatch |
---|
114 | * |
---|
115 | */ |
---|
116 | |
---|
117 | #define _Thread_Disable_dispatch() \ |
---|
118 | _Thread_Dispatch_disable_level += 1 |
---|
119 | |
---|
120 | /*PAGE |
---|
121 | * |
---|
122 | * _Thread_Enable_dispatch |
---|
123 | * |
---|
124 | */ |
---|
125 | |
---|
126 | #if ( CPU_INLINE_ENABLE_DISPATCH == TRUE ) |
---|
127 | #define _Thread_Enable_dispatch() \ |
---|
128 | { if ( (--_Thread_Dispatch_disable_level) == 0 ) \ |
---|
129 | _Thread_Dispatch(); \ |
---|
130 | } |
---|
131 | #endif |
---|
132 | |
---|
133 | #if ( CPU_INLINE_ENABLE_DISPATCH == FALSE ) |
---|
134 | void _Thread_Enable_dispatch( void ); |
---|
135 | #endif |
---|
136 | |
---|
137 | /*PAGE |
---|
138 | * |
---|
139 | * _Thread_Unnest_dispatch |
---|
140 | * |
---|
141 | */ |
---|
142 | |
---|
143 | #define _Thread_Unnest_dispatch() \ |
---|
144 | _Thread_Dispatch_disable_level -= 1 |
---|
145 | |
---|
146 | /*PAGE |
---|
147 | * |
---|
148 | * _Thread_Is_dispatching_enabled |
---|
149 | * |
---|
150 | */ |
---|
151 | |
---|
152 | #define _Thread_Is_dispatching_enabled() \ |
---|
153 | ( _Thread_Dispatch_disable_level == 0 ) |
---|
154 | |
---|
155 | /*PAGE |
---|
156 | * |
---|
157 | * _Thread_Is_context_switch_necessary |
---|
158 | * |
---|
159 | */ |
---|
160 | |
---|
161 | #define _Thread_Is_context_switch_necessary() \ |
---|
162 | ( _Context_Switch_necessary == TRUE ) |
---|
163 | |
---|
164 | /*PAGE |
---|
165 | * |
---|
166 | * _Thread_Dispatch_initialization |
---|
167 | * |
---|
168 | */ |
---|
169 | |
---|
170 | #define _Thread_Dispatch_initialization() \ |
---|
171 | _Thread_Dispatch_disable_level = 1 |
---|
172 | |
---|
173 | /*PAGE |
---|
174 | * |
---|
175 | * _Thread_Is_null |
---|
176 | * |
---|
177 | */ |
---|
178 | |
---|
179 | #define _Thread_Is_null( _the_thread ) \ |
---|
180 | ( (_the_thread) == NULL ) |
---|
181 | |
---|
182 | /* |
---|
183 | * _Thread_Is_proxy_blocking |
---|
184 | * |
---|
185 | */ |
---|
186 | |
---|
187 | #define _Thread_Is_proxy_blocking( _code ) \ |
---|
188 | ( (_code) == THREAD_STATUS_PROXY_BLOCKING ) |
---|
189 | |
---|
190 | /* |
---|
191 | * _Thread_Internal_allocate |
---|
192 | * |
---|
193 | */ |
---|
194 | |
---|
195 | #define _Thread_Internal_allocate() \ |
---|
196 | ((Thread_Control *) _Objects_Allocate( &_Thread_Internal_information )) |
---|
197 | |
---|
198 | /* |
---|
199 | * _Thread_Internal_free |
---|
200 | * |
---|
201 | */ |
---|
202 | |
---|
203 | #define _Thread_Internal_free( _the_task ) \ |
---|
204 | _Objects_Free( &_Thread_Internal_information, &(_the_task)->Object ) |
---|
205 | |
---|
206 | #endif |
---|
207 | /* end of include file */ |
---|