RTEMS  5.0.0
statesimpl.h
Go to the documentation of this file.
1 
10 /*
11  * COPYRIGHT (c) 1989-2012.
12  * On-Line Applications Research Corporation (OAR).
13  *
14  * The license and distribution terms for this file may be
15  * found in the file LICENSE in this distribution or at
16  * http://www.rtems.org/license/LICENSE.
17  */
18 
19 #ifndef _RTEMS_SCORE_STATESIMPL_H
20 #define _RTEMS_SCORE_STATESIMPL_H
21 
22 #include <rtems/score/states.h>
23 #include <rtems/score/basedefs.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
34 /*
35  * The following constants define the individual states which may be
36  * be used to compose and manipulate a thread's state. More frequently used
37  * states should use lower value bits to ease the use of immediate values on
38  * RISC architectures.
39  */
40 
42 #define STATES_READY 0x00000000
43 
45 #define STATES_WAITING_FOR_MUTEX 0x00000001
46 
48 #define STATES_WAITING_FOR_SEMAPHORE 0x00000002
49 
51 #define STATES_WAITING_FOR_EVENT 0x00000004
52 
54 #define STATES_WAITING_FOR_SYSTEM_EVENT 0x00000008
55 
57 #define STATES_WAITING_FOR_MESSAGE 0x00000010
58 
60 #define STATES_WAITING_FOR_CONDITION_VARIABLE 0x00000020
61 
63 #define STATES_WAITING_FOR_FUTEX 0x00000040
64 
66 #define STATES_WAITING_FOR_BSD_WAKEUP 0x00000080
67 
72 #define STATES_WAITING_FOR_TIME 0x00000100
73 
75 #define STATES_WAITING_FOR_PERIOD 0x00000200
76 
78 #define STATES_WAITING_FOR_SIGNAL 0x00000400
79 
81 #define STATES_WAITING_FOR_BARRIER 0x00000800
82 
84 #define STATES_WAITING_FOR_RWLOCK 0x00001000
85 
87 #define STATES_WAITING_FOR_JOIN_AT_EXIT 0x00002000
88 
90 #define STATES_WAITING_FOR_JOIN 0x00004000
91 
93 #define STATES_SUSPENDED 0x00008000
94 
96 #define STATES_WAITING_FOR_SEGMENT 0x00010000
97 
99 #define STATES_LIFE_IS_CHANGING 0x00020000
100 
102 #define STATES_DEBUGGER 0x08000000
103 
107 #define STATES_INTERRUPTIBLE_BY_SIGNAL 0x10000000
108 
110 #define STATES_WAITING_FOR_RPC_REPLY 0x20000000
111 
113 #define STATES_ZOMBIE 0x40000000
114 
116 #define STATES_DORMANT 0x80000000
117 
119 #define STATES_LOCALLY_BLOCKED ( STATES_WAITING_FOR_SEGMENT | \
120  STATES_WAITING_FOR_MESSAGE | \
121  STATES_WAITING_FOR_SEMAPHORE | \
122  STATES_WAITING_FOR_MUTEX | \
123  STATES_WAITING_FOR_CONDITION_VARIABLE | \
124  STATES_WAITING_FOR_JOIN | \
125  STATES_WAITING_FOR_SIGNAL | \
126  STATES_WAITING_FOR_BARRIER | \
127  STATES_WAITING_FOR_BSD_WAKEUP | \
128  STATES_WAITING_FOR_FUTEX | \
129  STATES_WAITING_FOR_RWLOCK )
130 
132 #define STATES_BLOCKED ( STATES_LOCALLY_BLOCKED | \
133  STATES_WAITING_FOR_TIME | \
134  STATES_WAITING_FOR_PERIOD | \
135  STATES_WAITING_FOR_EVENT | \
136  STATES_WAITING_FOR_RPC_REPLY | \
137  STATES_WAITING_FOR_SYSTEM_EVENT | \
138  STATES_INTERRUPTIBLE_BY_SIGNAL )
139 
141 #define STATES_ALL_SET 0xffffffff
142 
153  States_Control states_to_set,
154  States_Control current_state
155 )
156 {
157  return (current_state | states_to_set);
158 }
159 
170  States_Control states_to_clear,
171  States_Control current_state
172 )
173 {
174  return (current_state & ~states_to_clear);
175 }
176 
186  States_Control the_states
187 )
188 {
189  return (the_states == STATES_READY);
190 }
191 
201  States_Control the_states
202 )
203 {
204  return (the_states & STATES_DORMANT);
205 }
206 
216  States_Control the_states
217 )
218 {
219  return (the_states & STATES_SUSPENDED);
220 }
221 
231  States_Control the_states
232 )
233 {
234  return (the_states & STATES_WAITING_FOR_RPC_REPLY);
235 }
236 
237 RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_join_at_exit(
238  States_Control the_states
239 )
240 {
241  return ( the_states & STATES_WAITING_FOR_JOIN_AT_EXIT ) != 0;
242 }
243 
253  States_Control the_states
254 )
255 {
256  return (the_states & STATES_INTERRUPTIBLE_BY_SIGNAL);
257 
258 }
270  States_Control the_states
271 )
272 {
273  return (the_states & STATES_LOCALLY_BLOCKED);
274 }
275 
278 #ifdef __cplusplus
279 }
280 #endif
281 
282 #endif
283 /* end of include file */
RTEMS_INLINE_ROUTINE bool _States_Is_locally_blocked(States_Control the_states)
Definition: statesimpl.h:269
#define STATES_WAITING_FOR_JOIN_AT_EXIT
Definition: statesimpl.h:87
RTEMS_INLINE_ROUTINE bool _States_Is_dormant(States_Control the_states)
Definition: statesimpl.h:200
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:65
#define STATES_READY
Definition: statesimpl.h:42
Thread Execution State Information.
#define STATES_LOCALLY_BLOCKED
Definition: statesimpl.h:119
#define STATES_DORMANT
Definition: statesimpl.h:116
RTEMS_INLINE_ROUTINE bool _States_Is_suspended(States_Control the_states)
Definition: statesimpl.h:215
RTEMS_INLINE_ROUTINE bool _States_Is_interruptible_by_signal(States_Control the_states)
Definition: statesimpl.h:252
RTEMS_INLINE_ROUTINE States_Control _States_Clear(States_Control states_to_clear, States_Control current_state)
Definition: statesimpl.h:169
uint32_t States_Control
Definition: states.h:41
#define STATES_SUSPENDED
Definition: statesimpl.h:93
RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_rpc_reply(States_Control the_states)
Definition: statesimpl.h:230
RTEMS_INLINE_ROUTINE bool _States_Is_ready(States_Control the_states)
Definition: statesimpl.h:185
Basic Definitions.
#define STATES_WAITING_FOR_RPC_REPLY
Definition: statesimpl.h:110
#define STATES_INTERRUPTIBLE_BY_SIGNAL
Definition: statesimpl.h:107
RTEMS_INLINE_ROUTINE States_Control _States_Set(States_Control states_to_set, States_Control current_state)
Definition: statesimpl.h:152