Syntax
typedef struct tagThreadState {
RTHANDLE OwnerProcess;
RTHANDLE NextThread;
BYTE ThreadState;
BYTE SuspendDepth;
WORD DelayRequest;
RTHANDLE LastExchange;
DWORD KnDelayRequest;
KNHANDLE LastKnExchange;
CPUFRAME CpuFrame;
} THREADSTATE_SNAPSHOT, far *LPTHREADSTATE_SNAPSHOT;
Fields
OwnerProcess
- The handle for the process that contains the target thread.
NextThread
- The handle for the next thread on the system thread list, which allows easy scanning of all the threads in the system.
ThreadState
- One of the following indicates the thread's current state:
Value |
Meaning |
0x00 |
Ready and running |
0x01 |
Ready and not running |
0x02 |
Asleep |
0x03 |
Waiting at an exchange object |
0x04 |
Waiting at a region |
0x05 |
Waiting at an object directory |
0x06 |
Waiting at a port |
0x07 |
Being deleted |
0x08 |
Waiting at a kernel (low-level) object |
0x10 |
Suspended |
0x11 |
Self-suspended |
0x12 |
Asleep/Suspended |
0x13 |
Waiting at an exchange and Suspended |
0x14 |
Waiting at a region and Suspended |
0x15 |
Waiting at an object directory and Suspended |
0x16 |
Waiting at a port and suspended |
0x17 |
Being deleted and Suspended |
0x20 |
Suspended after a fault occurred |
0xff |
Thread state unknown |
SuspendDepth
- Suspension depth of this thread, which is non-zero only if the thread has been overtly suspended (as opposed to being suspended by the OS).
DelayRequest
- Amount of time the thread has waited at an exchange. This field is zero if the thread has waited at any other type of object.
LastExchange
- The handle for an exchange object (for example, mailbox or semaphore) at which the thread is waiting. This field is zero if the thread is not waiting at an exchange.
KnDelayRequest
- Amount of time the thread has waited at a kernel exchange. This field is 0 (zero) if the thread has waited at any other type of object.
LastKnExchange
- The handle for a kernel exchange object (for example, mailbox or semaphore) at which the thread is waiting. This field is zero if the thread is not waiting at a kernel exchange.
CpuFrame
- If the thread is suspended and the suspension depth is greater than 1, then the CpuFrame structure contains the CPU state when the suspension occurred.
See Also
GetRtThreadState, CpuFrame structure