Can a Windows CRITICAL_SECTION object be configured to deny recursive access?

こ雲淡風輕ζ 提交于 2019-12-01 20:28:11
Kirill Kobelev

No, it cannot. Documented APIs do not mention this in any way. Windows critical sections always accept recursive access.

A Critical Section always allows recursion within a thread. So does a Mutex. That is by design and cannot be changed.

A Semaphore, on the other hand, can prevent recursion within a thread. See MSDN documentation for more details.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!