summaryrefslogtreecommitdiffstats
path: root/c/src/exec/score/headers/states.h
blob: 1f8fd49fae752dd634edad235d7314a04d7a9d41 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*  states.h
 *
 *  This include file contains thread execution state information.
 *
 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
 *  On-Line Applications Research Corporation (OAR).
 *  All rights assigned to U.S. Government, 1994.
 *
 *  This material may be reproduced by or for the U.S. Government pursuant
 *  to the copyright license under the clause at DFARS 252.227-7013.  This
 *  notice must appear in all copies of this file and its derivatives.
 *
 *  $Id$
 */

#ifndef __RTEMS_STATES_h
#define __RTEMS_STATES_h

#ifdef __cplusplus
extern "C" {
#endif

/*
 *  The following type defines the control block used to manage a
 *  thread's state.
 */

typedef unsigned32 States_Control;

/*
 *  The following constants define the individual states which may be
 *  be used to compose and manipulate a thread's state.
 */

#define STATES_ALL_SET                         0xffff /* all states */
#define STATES_READY                           0x0000 /* ready to run */
#define STATES_DORMANT                         0x0001 /* created not started */
#define STATES_SUSPENDED                       0x0002 /* waiting for resume */
#define STATES_TRANSIENT                       0x0004 /* thread in transition */
#define STATES_DELAYING                        0x0008 /* wait for timeout */
#define STATES_WAITING_FOR_TIME                0x0010 /* wait for TOD */
#define STATES_WAITING_FOR_BUFFER              0x0020 
#define STATES_WAITING_FOR_SEGMENT             0x0040
#define STATES_WAITING_FOR_MESSAGE             0x0080
#define STATES_WAITING_FOR_EVENT               0x0100
#define STATES_WAITING_FOR_SEMAPHORE           0x0200
#define STATES_WAITING_FOR_MUTEX               0x0400
#define STATES_WAITING_FOR_CONDITION_VARIABLE  0x0800
#define STATES_WAITING_FOR_RPC_REPLY           0x1000
#define STATES_WAITING_FOR_PERIOD              0x2000

#define STATES_LOCALLY_BLOCKED ( STATES_WAITING_FOR_BUFFER             | \
                                 STATES_WAITING_FOR_SEGMENT            | \
                                 STATES_WAITING_FOR_MESSAGE            | \
                                 STATES_WAITING_FOR_MUTEX              | \
                                 STATES_WAITING_FOR_CONDITION_VARIABLE | \
                                 STATES_WAITING_FOR_SEMAPHORE   )

#define STATES_WAITING_ON_THREAD_QUEUE \
                               ( STATES_LOCALLY_BLOCKED         | \
                                 STATES_WAITING_FOR_RPC_REPLY   )

#define STATES_BLOCKED         ( STATES_DELAYING                | \
                                 STATES_WAITING_FOR_TIME        | \
                                 STATES_WAITING_FOR_PERIOD      | \
                                 STATES_WAITING_FOR_EVENT       | \
                                 STATES_WAITING_ON_THREAD_QUEUE )

#ifndef __RTEMS_APPLICATION__
#include <rtems/score/states.inl>
#endif

#ifdef __cplusplus
}
#endif

#endif
/* end of include file */