gpt4 book ai didi

windows - 如果线程在临界区内死亡,会发生什么?

转载 作者:可可西里 更新时间:2023-11-01 09:55:12 25 4
gpt4 key购买 nike

场景是这样的。我们有很多线程访问受临界区保护的一段代码,这确保一次只有一个线程可以访问该部分。现在的问题是,如果一个线程死在临界区内会发生什么?应用程序会挂起吗?或者有什么方法可以释放锁?

最佳答案

来自 MSDN:

If a thread terminates while it has ownership of a critical section, the state of the critical section is undefined.

来源:http://msdn.microsoft.com/en-us/library/windows/desktop/ms682608(v=vs.85).aspx

关于windows - 如果线程在临界区内死亡,会发生什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19069877/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com