从c/c 中终止线程中的线程,而无需线柄

Terminating a thread from within the thread in C/C++ without the thread handle

本文关键字:线程 终止      更新时间:2023-10-16

我是在Windows中编写一个使用C的多线程应用程序。在我的应用程序中,我必须从线程内终止线程。我没有螺纹的句柄,因此我无法使用Close Handle((函数。任何人都可以提出一个解决情况的想法。MSDN C 和Win32功能都被接受....谢谢,预先: - (

为了终止线程,您可以使用exitthread。

edit :正如评论中提到的 std::terminate中提到的那样, abortexit关闭了整个程序。