RTEMS  5.1
statesimpl.h
Go to the documentation of this file.
1 
12 /*
13  * COPYRIGHT (c) 1989-2012.
14  * On-Line Applications Research Corporation (OAR).
15  *
16  * The license and distribution terms for this file may be
17  * found in the file LICENSE in this distribution or at
18  * http://www.rtems.org/license/LICENSE.
19  */
20 
21 #ifndef _RTEMS_SCORE_STATESIMPL_H
22 #define _RTEMS_SCORE_STATESIMPL_H
23 
24 #include <rtems/score/states.h>
25 #include <rtems/score/basedefs.h>
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
37 /*
38  * The following constants define the individual states which may be
39  * be used to compose and manipulate a thread's state. More frequently used
40  * states should use lower value bits to ease the use of immediate values on
41  * RISC architectures.
42  */
43 
45 #define STATES_READY 0x00000000
46 
48 #define STATES_WAITING_FOR_MUTEX 0x00000001
49 
51 #define STATES_WAITING_FOR_SEMAPHORE 0x00000002
52 
54 #define STATES_WAITING_FOR_EVENT 0x00000004
55 
57 #define STATES_WAITING_FOR_SYSTEM_EVENT 0x00000008
58 
60 #define STATES_WAITING_FOR_MESSAGE 0x00000010
61 
63 #define STATES_WAITING_FOR_CONDITION_VARIABLE 0x00000020
64 
66 #define STATES_WAITING_FOR_FUTEX 0x00000040
67 
69 #define STATES_WAITING_FOR_BSD_WAKEUP 0x00000080
70 
75 #define STATES_WAITING_FOR_TIME 0x00000100
76 
78 #define STATES_WAITING_FOR_PERIOD 0x00000200
79 
81 #define STATES_WAITING_FOR_SIGNAL 0x00000400
82 
84 #define STATES_WAITING_FOR_BARRIER 0x00000800
85 
87 #define STATES_WAITING_FOR_RWLOCK 0x00001000
88 
90 #define STATES_WAITING_FOR_JOIN_AT_EXIT 0x00002000
91 
93 #define STATES_WAITING_FOR_JOIN 0x00004000
94 
96 #define STATES_SUSPENDED 0x00008000
97 
99 #define STATES_WAITING_FOR_SEGMENT 0x00010000
100 
102 #define STATES_LIFE_IS_CHANGING 0x00020000
103 
105 #define STATES_DEBUGGER 0x08000000
106 
110 #define STATES_INTERRUPTIBLE_BY_SIGNAL 0x10000000
111 
113 #define STATES_WAITING_FOR_RPC_REPLY 0x20000000
114 
116 #define STATES_ZOMBIE 0x40000000
117 
119 #define STATES_DORMANT 0x80000000
120 
122 #define STATES_LOCALLY_BLOCKED ( STATES_WAITING_FOR_SEGMENT | \
123  STATES_WAITING_FOR_MESSAGE | \
124  STATES_WAITING_FOR_SEMAPHORE | \
125  STATES_WAITING_FOR_MUTEX | \
126  STATES_WAITING_FOR_CONDITION_VARIABLE | \
127  STATES_WAITING_FOR_JOIN | \
128  STATES_WAITING_FOR_SIGNAL | \
129  STATES_WAITING_FOR_BARRIER | \
130  STATES_WAITING_FOR_BSD_WAKEUP | \
131  STATES_WAITING_FOR_FUTEX | \
132  STATES_WAITING_FOR_RWLOCK )
133 
135 #define STATES_BLOCKED ( STATES_LOCALLY_BLOCKED | \
136  STATES_WAITING_FOR_TIME | \
137  STATES_WAITING_FOR_PERIOD | \
138  STATES_WAITING_FOR_EVENT | \
139  STATES_WAITING_FOR_RPC_REPLY | \
140  STATES_WAITING_FOR_SYSTEM_EVENT | \
141  STATES_INTERRUPTIBLE_BY_SIGNAL )
142 
144 #define STATES_ALL_SET 0xffffffff
145 
158  States_Control states_to_set,
159  States_Control current_state
160 )
161 {
162  return (current_state | states_to_set);
163 }
164 
177  States_Control states_to_clear,
178  States_Control current_state
179 )
180 {
181  return (current_state & ~states_to_clear);
182 }
183 
196  States_Control the_states
197 )
198 {
199  return (the_states == STATES_READY);
200 }
201 
214  States_Control the_states
215 )
216 {
217  return (the_states & STATES_DORMANT);
218 }
219 
232  States_Control the_states
233 )
234 {
235  return (the_states & STATES_SUSPENDED);
236 }
237 
250  States_Control the_states
251 )
252 {
253  return (the_states & STATES_WAITING_FOR_RPC_REPLY);
254 }
255 
268  States_Control the_states
269 )
270 {
271  return ( the_states & STATES_WAITING_FOR_JOIN_AT_EXIT ) != 0;
272 }
273 
286  States_Control the_states
287 )
288 {
289  return (the_states & STATES_INTERRUPTIBLE_BY_SIGNAL);
290 }
291 
307  States_Control the_states
308 )
309 {
310  return (the_states & STATES_LOCALLY_BLOCKED);
311 }
312 
315 #ifdef __cplusplus
316 }
317 #endif
318 
319 #endif
320 /* end of include file */
RTEMS_INLINE_ROUTINE bool _States_Is_dormant(States_Control the_states)
Checks if DORMANT state is set.
Definition: statesimpl.h:213
#define STATES_LOCALLY_BLOCKED
Definition: statesimpl.h:122
#define STATES_INTERRUPTIBLE_BY_SIGNAL
Definition: statesimpl.h:110
Thread Execution State Information.
RTEMS_INLINE_ROUTINE States_Control _States_Set(States_Control states_to_set, States_Control current_state)
Returns the result of setting the states to set to the given state.
Definition: statesimpl.h:157
uint32_t States_Control
Definition: states.h:46
RTEMS_INLINE_ROUTINE bool _States_Is_interruptible_by_signal(States_Control the_states)
Checks if the state is set to be interruptible.
Definition: statesimpl.h:285
#define STATES_DORMANT
Definition: statesimpl.h:119
RTEMS_INLINE_ROUTINE bool _States_Is_suspended(States_Control the_states)
Checks if SUSPENDED state is set.
Definition: statesimpl.h:231
#define STATES_SUSPENDED
Definition: statesimpl.h:96
RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_join_at_exit(States_Control the_states)
Checks if WAITING_FOR_JOIN_AT_EXIT state is set.
Definition: statesimpl.h:267
RTEMS_INLINE_ROUTINE States_Control _States_Clear(States_Control states_to_clear, States_Control current_state)
Clears the states into the passed current state and returns the result.
Definition: statesimpl.h:176
#define STATES_READY
Definition: statesimpl.h:45
RTEMS_INLINE_ROUTINE bool _States_Is_ready(States_Control the_states)
Checks if the state is ready.
Definition: statesimpl.h:195
Basic Definitions.
RTEMS_INLINE_ROUTINE bool _States_Is_locally_blocked(States_Control the_states)
Checks if the state is blocked waiting on a local resource.
Definition: statesimpl.h:306
#define STATES_WAITING_FOR_JOIN_AT_EXIT
Definition: statesimpl.h:90
RTEMS_INLINE_ROUTINE bool _States_Is_waiting_for_rpc_reply(States_Control the_states)
Checks if WAITING_FOR_TIME state is set.
Definition: statesimpl.h:249
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:66
#define STATES_WAITING_FOR_RPC_REPLY
Definition: statesimpl.h:113