RTEMS 6.1-rc2
Loading...
Searching...
No Matches
statesimpl.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
12/*
13 * COPYRIGHT (c) 1989-2012.
14 * On-Line Applications Research Corporation (OAR).
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#ifndef _RTEMS_SCORE_STATESIMPL_H
39#define _RTEMS_SCORE_STATESIMPL_H
40
41#include <rtems/score/states.h>
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
54/*
55 * The following constants define the individual states which may be
56 * be used to compose and manipulate a thread's state. More frequently used
57 * states should use lower value bits to ease the use of immediate values on
58 * RISC architectures.
59 */
60
62#define STATES_READY 0x00000000
63
65#define STATES_WAITING_FOR_MUTEX 0x00000001
66
68#define STATES_WAITING_FOR_SEMAPHORE 0x00000002
69
71#define STATES_WAITING_FOR_EVENT 0x00000004
72
74#define STATES_WAITING_FOR_SYSTEM_EVENT 0x00000008
75
77#define STATES_WAITING_FOR_MESSAGE 0x00000010
78
80#define STATES_WAITING_FOR_CONDITION_VARIABLE 0x00000020
81
83#define STATES_WAITING_FOR_FUTEX 0x00000040
84
86#define STATES_WAITING_FOR_BSD_WAKEUP 0x00000080
87
92#define STATES_WAITING_FOR_TIME 0x00000100
93
95#define STATES_WAITING_FOR_PERIOD 0x00000200
96
98#define STATES_WAITING_FOR_SIGNAL 0x00000400
99
101#define STATES_WAITING_FOR_BARRIER 0x00000800
102
104#define STATES_WAITING_FOR_RWLOCK 0x00001000
105
107#define STATES_WAITING_FOR_JOIN_AT_EXIT 0x00002000
108
110#define STATES_WAITING_FOR_JOIN 0x00004000
111
113#define STATES_SUSPENDED 0x00008000
114
116#define STATES_WAITING_FOR_SEGMENT 0x00010000
117
119#define STATES_LIFE_IS_CHANGING 0x00020000
120
122#define STATES_DEBUGGER 0x08000000
123
127#define STATES_INTERRUPTIBLE_BY_SIGNAL 0x10000000
128
130#define STATES_WAITING_FOR_RPC_REPLY 0x20000000
131
133#define STATES_ZOMBIE 0x40000000
134
136#define STATES_DORMANT 0x80000000
137
139#define STATES_LOCALLY_BLOCKED ( STATES_WAITING_FOR_SEGMENT | \
140 STATES_WAITING_FOR_MESSAGE | \
141 STATES_WAITING_FOR_SEMAPHORE | \
142 STATES_WAITING_FOR_MUTEX | \
143 STATES_WAITING_FOR_CONDITION_VARIABLE | \
144 STATES_WAITING_FOR_JOIN | \
145 STATES_WAITING_FOR_SIGNAL | \
146 STATES_WAITING_FOR_BARRIER | \
147 STATES_WAITING_FOR_BSD_WAKEUP | \
148 STATES_WAITING_FOR_FUTEX | \
149 STATES_WAITING_FOR_RWLOCK )
150
152#define STATES_BLOCKED ( STATES_LOCALLY_BLOCKED | \
153 STATES_WAITING_FOR_TIME | \
154 STATES_WAITING_FOR_PERIOD | \
155 STATES_WAITING_FOR_EVENT | \
156 STATES_WAITING_FOR_RPC_REPLY | \
157 STATES_WAITING_FOR_SYSTEM_EVENT | \
158 STATES_INTERRUPTIBLE_BY_SIGNAL )
159
161#define STATES_ALL_SET 0xffffffff
162
174static inline States_Control _States_Set (
175 States_Control states_to_set,
176 States_Control current_state
177)
178{
179 return (current_state | states_to_set);
180}
181
193static inline States_Control _States_Clear (
194 States_Control states_to_clear,
195 States_Control current_state
196)
197{
198 return (current_state & ~states_to_clear);
199}
200
212static inline bool _States_Is_ready (
213 States_Control the_states
214)
215{
216 return (the_states == STATES_READY);
217}
218
230static inline bool _States_Is_dormant (
231 States_Control the_states
232)
233{
234 return (the_states & STATES_DORMANT);
235}
236
248static inline bool _States_Is_suspended (
249 States_Control the_states
250)
251{
252 return (the_states & STATES_SUSPENDED);
253}
254
266static inline bool _States_Is_waiting_for_rpc_reply (
267 States_Control the_states
268)
269{
270 return (the_states & STATES_WAITING_FOR_RPC_REPLY);
271}
272
284static inline bool _States_Is_waiting_for_join_at_exit(
285 States_Control the_states
286)
287{
288 return ( the_states & STATES_WAITING_FOR_JOIN_AT_EXIT ) != 0;
289}
290
302static inline bool _States_Is_interruptible_by_signal (
303 States_Control the_states
304)
305{
306 return (the_states & STATES_INTERRUPTIBLE_BY_SIGNAL);
307}
308
323static inline bool _States_Is_locally_blocked (
324 States_Control the_states
325)
326{
327 return (the_states & STATES_LOCALLY_BLOCKED);
328}
329
332#ifdef __cplusplus
333}
334#endif
335
336#endif
337/* end of include file */
This header file provides basic definitions used by the API and the implementation.
#define STATES_INTERRUPTIBLE_BY_SIGNAL
Definition: statesimpl.h:127
#define STATES_LOCALLY_BLOCKED
Definition: statesimpl.h:139
#define STATES_WAITING_FOR_JOIN_AT_EXIT
Definition: statesimpl.h:107
#define STATES_WAITING_FOR_RPC_REPLY
Definition: statesimpl.h:130
#define STATES_READY
Definition: statesimpl.h:62
#define STATES_DORMANT
Definition: statesimpl.h:136
#define STATES_SUSPENDED
Definition: statesimpl.h:113
uint32_t States_Control
Definition: states.h:65
This header file provides interfaces of the Thread States which are used by the implementation and th...