複製鏈接
請複製以下鏈接發送給好友

ResumeThread

鎖定
使線程的掛起時間計數減一。創建一個掛起的線程或者手動掛起一個線程後調用。調用該函數後線程不一定會立刻執行,而是由操作系統繼續調度,直到計數為0,系統為其分配資源時才開始執行。
中文名
線程恢復函數
外文名
ResumeThread
來    自
微軟
屬    性
編程使用
頭文件
WinBase.h

ResumeThread函數聲明

C++
DWORD WINAPI ResumeThread(_In_ HANDLE hThread);

ResumeThread參數説明

hthread[in]要重新啓動的線程的句柄。此句柄必須具有線程“掛起”恢復訪問權限。有關詳細信息,請參閲線程安全和訪問權限。

ResumeThread返回值

如果函數成功,返回值是線程的上一個掛起計數。
如果函數失敗,返回值為(dword)-1。要獲取擴展錯誤信息,請調用GetLastError。

ResumeThread注意事項

resumeThread函數檢查主題線程的掛起計數。如果掛起計數為零,則線程當前未掛起。否則,主題線程的掛起計數將減少。如果結果值為零,則繼續執行主題線程。
如果返回值為零,則指定的線程沒有掛起。如果返回值為1,則指定的線程已掛起,但已重新啓動。如果返回值大於1,則指定的線程仍將掛起。
請注意,在報告調試事件時,報告進程中的所有線程都將被凍結。調試程序需要使用suspendthread和resumethread函數來限制可以在進程內執行的線程集。通過掛起進程中除報告調試事件的線程外的所有線程,可以“單步”處理單個線程。如果掛起其他線程,則繼續操作不會釋放這些線程。

ResumeThread英文原文

Decrements a thread's suspend count. When the suspend count is decremented to zero, the execution of the thread is resumed.

ResumeThread微軟原文

ResumeThread Function
Decrements a thread's suspend count. When the suspend count is decremented to zero, the execution of the thread is resumed.