Check if a Win32 thread is running or in a suspended state

前端 未结 7 1539
清歌不尽
清歌不尽 2020-12-01 11:26

How do I check to see if a Win32 thread is running or in suspended state?

I can\'t find any Win32 API which gives the state of a thread. So how do I get the thread s

7条回答
  •  不思量自难忘°
    2020-12-01 11:40

    you could get thread suspend count with code like this:

    DWORD GetThreadSuspendCount(HANDLE hThread) {
        DWORD dwSuspendCount = SuspendThread(hThread);
        ResumeThread(hThread);
        return dwSuspendCount;
    }
    

    but, as already said - it is not accurate. Moreover, suspending a thread is evil.

提交回复
热议问题