ICorDebugThread::SetDebugState Method
Sets flags that describe the debugging state of this ICorDebugThread Interface.
HRESULT SetDebugState (
[in] CorDebugThreadState state
);
Parameters
Parameter | Description |
---|---|
state |
[in] A bitwise combination of CorDebugThreadState Enumeration enumeration values that specify the debugging state of this thread. |
Remarks
SetDebugState sets the current debug state of the thread. (The "current debug state" represents the debug state if the process were to be continued, not the actual current state.) The normal value for this is THREAD_RUNNING. Only the debugger can affect the debug state of a thread. Debug states do last across continues, so if you want to keep a thread THREAD_SUSPENDed over multiple continues, you can set it once and thereafter not have to worry about it. Suspending threads and resuming the process can cause deadlocks, though it's usually unlikely. This is an intrinsic quality of threads and processes and is by-design. A debugger can asynchronously break and resume the threads to break the deadlock. If the thread's user state includes USER_UNSAFE_POINT, then the thread may block a garbage collection (GC). This means the suspended thread has a much higher chance of causing a deadlock. This may not affect debug events already queued. Thus a debugger should drain the entire event queue (by calling ICorDebugController::HasQueuedCallbacks Method) before suspending or resuming threads. Else it may get events on a thread that it believes it has already suspended.
Requirements
Platforms: Windows 2000, Windows XP, Windows Server 2003 family
Header: CorDebug.idl
Library: CorGuids.lib
.NET Framework Version: 2.0, 1.1, 1.0