1 | /** |
---|
2 | * @file rtems/score/states.h |
---|
3 | * |
---|
4 | * This include file contains thread execution state information. |
---|
5 | */ |
---|
6 | |
---|
7 | /* |
---|
8 | * COPYRIGHT (c) 1989-2006. |
---|
9 | * On-Line Applications Research Corporation (OAR). |
---|
10 | * |
---|
11 | * The license and distribution terms for this file may be |
---|
12 | * found in the file LICENSE in this distribution or at |
---|
13 | * http://www.rtems.com/license/LICENSE. |
---|
14 | */ |
---|
15 | |
---|
16 | #ifndef _RTEMS_SCORE_STATES_H |
---|
17 | #define _RTEMS_SCORE_STATES_H |
---|
18 | |
---|
19 | /** |
---|
20 | * @defgroup ScoreStates Thread States Handler |
---|
21 | * |
---|
22 | * @ingroup Score |
---|
23 | * |
---|
24 | * This handler encapsulates functionality which relates to the management of |
---|
25 | * the state bitmap associated with each thread. |
---|
26 | */ |
---|
27 | /**@{*/ |
---|
28 | |
---|
29 | #ifdef __cplusplus |
---|
30 | extern "C" { |
---|
31 | #endif |
---|
32 | |
---|
33 | /** |
---|
34 | * The following type defines the control block used to manage a |
---|
35 | * thread's state. |
---|
36 | */ |
---|
37 | typedef uint32_t States_Control; |
---|
38 | |
---|
39 | /* |
---|
40 | * The following constants define the individual states which may be |
---|
41 | * be used to compose and manipulate a thread's state. |
---|
42 | */ |
---|
43 | |
---|
44 | /** This macro corresponds to all states being set. */ |
---|
45 | #define STATES_ALL_SET 0xfffff |
---|
46 | /** This macro corresponds to a task being ready. */ |
---|
47 | #define STATES_READY 0x00000 |
---|
48 | /** This macro corresponds to a task being created but not yet started. */ |
---|
49 | #define STATES_DORMANT 0x00001 |
---|
50 | /** This macro corresponds to a task being suspended. */ |
---|
51 | #define STATES_SUSPENDED 0x00002 |
---|
52 | /** This macro corresponds to a task being in an internal state transition. */ |
---|
53 | #define STATES_TRANSIENT 0x00004 |
---|
54 | /** This macro corresponds to a task which is waiting for a timeout. */ |
---|
55 | #define STATES_DELAYING 0x00008 |
---|
56 | /** This macro corresponds to a task waiting until a specific TOD. */ |
---|
57 | #define STATES_WAITING_FOR_TIME 0x00010 |
---|
58 | /** This macro corresponds to a task waiting for a variable length buffer. */ |
---|
59 | #define STATES_WAITING_FOR_BUFFER 0x00020 |
---|
60 | /** This macro corresponds to a task waiting for a fixed size segment. */ |
---|
61 | #define STATES_WAITING_FOR_SEGMENT 0x00040 |
---|
62 | /** This macro corresponds to a task waiting for a message. */ |
---|
63 | #define STATES_WAITING_FOR_MESSAGE 0x00080 |
---|
64 | /** This macro corresponds to a task waiting for an event. */ |
---|
65 | #define STATES_WAITING_FOR_EVENT 0x00100 |
---|
66 | /** This macro corresponds to a task waiting for a semaphore. */ |
---|
67 | #define STATES_WAITING_FOR_SEMAPHORE 0x00200 |
---|
68 | /** This macro corresponds to a task waiting for a mutex. */ |
---|
69 | #define STATES_WAITING_FOR_MUTEX 0x00400 |
---|
70 | /** This macro corresponds to a task waiting for a condition variable. */ |
---|
71 | #define STATES_WAITING_FOR_CONDITION_VARIABLE 0x00800 |
---|
72 | /** This macro corresponds to a task waiting for a join while exiting. */ |
---|
73 | #define STATES_WAITING_FOR_JOIN_AT_EXIT 0x01000 |
---|
74 | /** This macro corresponds to a task waiting for a reply to an MPCI request. */ |
---|
75 | #define STATES_WAITING_FOR_RPC_REPLY 0x02000 |
---|
76 | /** This macro corresponds to a task waiting for a period. */ |
---|
77 | #define STATES_WAITING_FOR_PERIOD 0x04000 |
---|
78 | /** This macro corresponds to a task waiting for a signal. */ |
---|
79 | #define STATES_WAITING_FOR_SIGNAL 0x08000 |
---|
80 | /** This macro corresponds to a task waiting for a barrier. */ |
---|
81 | #define STATES_WAITING_FOR_BARRIER 0x10000 |
---|
82 | /** This macro corresponds to a task waiting for a RWLock. */ |
---|
83 | #define STATES_WAITING_FOR_RWLOCK 0x20000 |
---|
84 | /** This macro corresponds to a task waiting for a system event. */ |
---|
85 | #define STATES_WAITING_FOR_SYSTEM_EVENT 0x40000 |
---|
86 | |
---|
87 | /** This macro corresponds to a task which is in an interruptible |
---|
88 | * blocking state. |
---|
89 | */ |
---|
90 | #define STATES_INTERRUPTIBLE_BY_SIGNAL 0x10000000 |
---|
91 | |
---|
92 | /** This macro corresponds to a task waiting for a local object operation. */ |
---|
93 | #define STATES_LOCALLY_BLOCKED ( STATES_WAITING_FOR_BUFFER | \ |
---|
94 | STATES_WAITING_FOR_SEGMENT | \ |
---|
95 | STATES_WAITING_FOR_MESSAGE | \ |
---|
96 | STATES_WAITING_FOR_SEMAPHORE | \ |
---|
97 | STATES_WAITING_FOR_MUTEX | \ |
---|
98 | STATES_WAITING_FOR_CONDITION_VARIABLE | \ |
---|
99 | STATES_WAITING_FOR_JOIN_AT_EXIT | \ |
---|
100 | STATES_WAITING_FOR_SIGNAL | \ |
---|
101 | STATES_WAITING_FOR_BARRIER | \ |
---|
102 | STATES_WAITING_FOR_RWLOCK ) |
---|
103 | |
---|
104 | /** This macro corresponds to a task waiting which is blocked on |
---|
105 | * a thread queue. */ |
---|
106 | #define STATES_WAITING_ON_THREAD_QUEUE \ |
---|
107 | ( STATES_LOCALLY_BLOCKED | \ |
---|
108 | STATES_WAITING_FOR_RPC_REPLY ) |
---|
109 | |
---|
110 | /** This macro corresponds to a task waiting which is blocked. */ |
---|
111 | #define STATES_BLOCKED ( STATES_DELAYING | \ |
---|
112 | STATES_WAITING_FOR_TIME | \ |
---|
113 | STATES_WAITING_FOR_PERIOD | \ |
---|
114 | STATES_WAITING_FOR_EVENT | \ |
---|
115 | STATES_WAITING_FOR_SYSTEM_EVENT | \ |
---|
116 | STATES_WAITING_ON_THREAD_QUEUE | \ |
---|
117 | STATES_INTERRUPTIBLE_BY_SIGNAL ) |
---|
118 | |
---|
119 | #ifndef __RTEMS_APPLICATION__ |
---|
120 | #include <rtems/score/states.inl> |
---|
121 | #endif |
---|
122 | |
---|
123 | #ifdef __cplusplus |
---|
124 | } |
---|
125 | #endif |
---|
126 | |
---|
127 | /**@}*/ |
---|
128 | |
---|
129 | #endif |
---|
130 | /* end of include file */ |
---|