summaryrefslogtreecommitdiff
path: root/mit-pthreads/include/pthread/state.def
blob: c62d102a9f0b74c8f11f9726943bc6b7aad5cf39 (plain)
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
/* This file defines the states that a given thread can be in.

   The funky macro use here is so that this one header file can also
   define the corresponding state names, so that the two lists can't
   get inconsistent within a given source tree.  */

/* The thread is runnable. */
__pthread_defstate (PS_RUNNING,		"running")

/*
 * The rest of the states are where the thread is waiting on some event.
 * Someday maybe the "data" field will point to the object being waited for. 
 */

/* Waiting for a mutex (pthread_mutex_lock()). */
__pthread_defstate (PS_MUTEX_WAIT,	"mutex")

/* Waiting on a condition variable 
   (pthread_cond_wait(), or pthread_cond_timedwait()).  */
__pthread_defstate (PS_COND_WAIT,	"cond")

/*
 * File descriptor stuff. 
 *
 * File descriptors have a special lock. If it is a FULL_DUPLEX fd such as
 * a socket or fifo then it has two mutexes, one for reads and one for writes.
 * Some routines will even try to get both. It will always try to get the
 * read lock first before tring to get the write. All other fds only have
 * one mutex which all calls will get. It is displayed as if it is a read lock.
 */
/* Waiting on a fd read lock (fd_lock()) */
__pthread_defstate (PS_FDLR_WAIT,	"fdlr")	

/* Waiting on a fd write lock (fd_lock()) */
__pthread_defstate (PS_FDLW_WAIT,	"fdlw")	

/* Waiting for the kernel fd to have data to read, 
  (read(), readv(), recv(), recvfrom(), and recvmsg()). */
__pthread_defstate (PS_FDR_WAIT,	"fdr")	/* Waiting on a kernel read */

/* Waiting for the kernel fd to allow a write
  (write(), writev(), send(), sendto(), sendmsg()) */
__pthread_defstate (PS_FDW_WAIT,	"fdw")	

/* Waiting for several fds in a select() */
__pthread_defstate (PS_SELECT_WAIT,	"select")	

/* Waiting on a sleep (sleep(), usleep() or nanosleep()).  */
__pthread_defstate (PS_SLEEP_WAIT,	"sleep")

/* Waiting for a child to die (wait(), waitpid(), wait3(), or wait4()). */
__pthread_defstate (PS_WAIT_WAIT,	"wait")

/* Waiting on some set of signals (sigwait()) */
__pthread_defstate (PS_SIGWAIT,		"sig")

/* Waiting for a thread to die (pthread_join()) */
__pthread_defstate (PS_JOIN,		"join")

/* Waiting for some thread to join with me or detach me */
__pthread_defstate (PS_DEAD,		"dead")

/* Waiting for some thread to create me */
__pthread_defstate (PS_UNALLOCED,	"unallocated")