积极答复者
怎样退出指定线程

问题
答案
-
你的线程函数中怎么做的呢?比如可以设置一个标记,不符合条件的时候,线程自己return返回。尽量避免使用TerminateThread来强制结束进程。
Visual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE/Windows Mobile platform embedded development.- 已建议为答案 SplendourGModerator 2011年3月24日 9:17
- 已标记为答案 wh_xiao 2011年3月26日 11:57
-
Hi wh_xiao,
>>如果有多个线程同时在运行,我想要退出某个指定的线程,用什么函数?
除了visualEleven 的方法外,我们还可以尝试用StateManager::Exit 方法,此方法可以退出指定线程,将其在逻辑执行者清单中的位置设定为nullptr。
更多信息:http://msdn.microsoft.com/en-us/library/dd483637(d=robot).aspx
如果您的问题解决了,请把有用的回答标记为答案!
谢谢,
Lucy
Lucy Liu [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- 已标记为答案 wh_xiao 2011年3月26日 11:57
全部回复
-
你的线程函数中怎么做的呢?比如可以设置一个标记,不符合条件的时候,线程自己return返回。尽量避免使用TerminateThread来强制结束进程。
Visual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE/Windows Mobile platform embedded development.- 已建议为答案 SplendourGModerator 2011年3月24日 9:17
- 已标记为答案 wh_xiao 2011年3月26日 11:57
-
Hi wh_xiao,
>>如果有多个线程同时在运行,我想要退出某个指定的线程,用什么函数?
除了visualEleven 的方法外,我们还可以尝试用StateManager::Exit 方法,此方法可以退出指定线程,将其在逻辑执行者清单中的位置设定为nullptr。
更多信息:http://msdn.microsoft.com/en-us/library/dd483637(d=robot).aspx
如果您的问题解决了,请把有用的回答标记为答案!
谢谢,
Lucy
Lucy Liu [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- 已标记为答案 wh_xiao 2011年3月26日 11:57