source: rtems/c/src/exec/score/inline/thread.inl @ 88d594a

4.104.114.84.95
Last change on this file since 88d594a was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/95 at 17:39:37

Initial revision

  • Property mode set to 100644
File size: 3.9 KB
Line 
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, 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 __THREAD_inl
18#define __THREAD_inl
19
20/*PAGE
21 *
22 *  _Thread_Stop_multitasking
23 *
24 */
25
26STATIC INLINE void _Thread_Stop_multitasking( void )
27{
28  _Context_Switch( &_Thread_Executing->Registers, &_Thread_BSP_context );
29}
30
31/*PAGE
32 *
33 *  _Thread_Is_executing
34 *
35 */
36
37STATIC INLINE boolean _Thread_Is_executing (
38  Thread_Control *the_thread
39)
40{
41  return ( the_thread == _Thread_Executing );
42}
43
44/*PAGE
45 *
46 *  _Thread_Is_heir
47 *
48 */
49
50STATIC INLINE boolean _Thread_Is_heir (
51  Thread_Control *the_thread
52)
53{
54  return ( the_thread == _Thread_Heir );
55}
56
57/*PAGE
58 *
59 *  _Thread_Is_executing_also_the_heir
60 *
61 */
62
63STATIC INLINE boolean _Thread_Is_executing_also_the_heir( void )
64{
65  return ( _Thread_Executing == _Thread_Heir );
66}
67
68/*PAGE
69 *
70 *  _Thread_Resume
71 *
72 */
73
74STATIC INLINE void _Thread_Resume (
75  Thread_Control *the_thread
76)
77{
78  _Thread_Clear_state( the_thread, STATES_SUSPENDED );
79}
80
81/*PAGE
82 *
83 *  _Thread_Unblock
84 *
85 */
86
87STATIC INLINE void _Thread_Unblock (
88  Thread_Control *the_thread
89)
90{
91  _Thread_Clear_state( the_thread, STATES_BLOCKED );
92}
93
94/*PAGE
95 *
96 *  _Thread_Restart_self
97 *
98 */
99
100STATIC INLINE void _Thread_Restart_self( void )
101{
102  if ( _Thread_Executing->fp_context != NULL )
103    _Context_Restore_fp( &_Thread_Executing->fp_context );
104
105  _CPU_Context_Restart_self( &_Thread_Executing->Registers );
106}
107
108/*PAGE
109 *
110 *  _Thread_Calculate_heir
111 *
112 */
113
114STATIC INLINE void _Thread_Calculate_heir( void )
115{
116  _Thread_Heir = (Thread_Control *)
117    _Thread_Ready_chain[ _Priority_Get_highest() ].first;
118}
119
120/*PAGE
121 *
122 *  _Thread_Is_allocated_fp
123 *
124 */
125
126STATIC INLINE boolean _Thread_Is_allocated_fp (
127  Thread_Control *the_thread
128)
129{
130  return ( the_thread == _Thread_Allocated_fp );
131}
132
133/*PAGE
134 *
135 *  _Thread_Deallocate_fp
136 *
137 */
138
139STATIC INLINE void _Thread_Deallocate_fp( void )
140{
141  _Thread_Allocated_fp = NULL;
142}
143
144/*PAGE
145 *
146 *  _Thread_Disable_dispatch
147 *
148 */
149
150STATIC INLINE void _Thread_Disable_dispatch( void )
151{
152  _Thread_Dispatch_disable_level += 1;
153}
154
155/*PAGE
156 *
157 *  _Thread_Enable_dispatch
158 *
159 */
160
161#if ( CPU_INLINE_ENABLE_DISPATCH == TRUE )
162STATIC INLINE void _Thread_Enable_dispatch()
163{
164  if ( (--_Thread_Dispatch_disable_level) == 0 )
165    _Thread_Dispatch();
166}
167#endif
168
169#if ( CPU_INLINE_ENABLE_DISPATCH == FALSE )
170void _Thread_Enable_dispatch( void );
171#endif
172
173/*PAGE
174 *
175 *  _Thread_Unnest_dispatch
176 *
177 */
178
179STATIC INLINE void _Thread_Unnest_dispatch( void )
180{
181  _Thread_Dispatch_disable_level -= 1;
182}
183
184/*PAGE
185 *
186 *  _Thread_Is_dispatching_enabled
187 *
188 */
189
190STATIC INLINE boolean _Thread_Is_dispatching_enabled( void )
191{
192  return ( _Thread_Dispatch_disable_level == 0 );
193}
194
195/*PAGE
196 *
197 *  _Thread_Is_context_switch_necessary
198 *
199 */
200
201STATIC INLINE boolean _Thread_Is_context_switch_necessary( void )
202{
203  return ( _Context_Switch_necessary );
204}
205
206/*PAGE
207 *
208 *  _Thread_Dispatch_initialization
209 *
210 */
211
212STATIC INLINE void _Thread_Dispatch_initialization( void )
213{
214  _Thread_Dispatch_disable_level = 1;
215}
216
217/*PAGE
218 *
219 *  _Thread_Is_null
220 *
221 */
222
223STATIC INLINE boolean _Thread_Is_null (
224  Thread_Control *the_thread
225)
226{
227  return ( the_thread == NULL );
228}
229
230/*PAGE
231 *
232 *  _Thread_Get
233 *
234 */
235
236STATIC INLINE Thread_Control *_Thread_Get (
237  Objects_Id         id,
238  Objects_Locations *location
239)
240{
241  if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ) {
242     _Thread_Disable_dispatch();
243     *location = OBJECTS_LOCAL;
244     return( _Thread_Executing );
245  }
246
247  return (Thread_Control *)
248          _Objects_Get( &_Thread_Information, id, location );
249}
250
251#endif
252/* end of include file */
Note: See TracBrowser for help on using the repository browser.