文档导航目录(5 专栏 / 65 篇)

7-线程控制

win32基础 更新于 2024-03-16 1 分钟 0 次阅读 0 条评论

让线程挂起

c++
DWORD SuspendThread(
    HANDLE hThread
     // handle to the thread
);

让挂起的线程恢复

c++
DWORD ResumeThread(
    HANDLE hThread
     // identifies thread to restart
);

一个线程可以挂起多次,挂起多少次就得恢复多少次。

等待线程执行完毕函数

c++
DWORD WaitForSingleObject(
    HANDLE hHandle,
     // handle of object to wait for
    DWORD dwMilliseconds
     // time-out interval in milliseconds
);

用法可参考:https://www.cnblogs.com/rainbow70626/p/10170733.html

获取线程结束后的返回值

c++
BOOL GetExitCodeThread(
    HANDLE hThread,
     // handle to the thread
    LPDWORD lpExitCode
     // address to receive termination status
);

If the function succeeds, the return value is nonzero.

评论讨论 (0) Artalk 自托管