c++ - Windows 的 AcquireSRWLockExclusive 是递归的吗?

标签 c++ multithreading winapi readwritelock

我需要使用读写锁,但我也想确保锁在读写模式下都是递归的,这样在同一个线程上使用它的调用函数就不会锁定。

我在 MSDN 文档上找不到任何内容。也许它藏在某个地方而我没有找到它?

最佳答案

SRWLocks 不是递归的,来自 the docs :

An SRW lock is the size of a pointer. The advantage is that it is fast to update the lock state. The disadvantage is that very little state information can be stored, so SRW locks cannot be acquired recursively. In addition, a thread that owns an SRW lock in shared mode cannot upgrade its ownership of the lock to exclusive mode.

关于c++ - Windows 的 AcquireSRWLockExclusive 是递归的吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57623508/

相关文章:

java - shutdownNow 与执行程序服务

c++ - 如何从文件系统填充 XML 树?

c++ - 特拉维斯 CI : clang deduces copy constructor when it should deduce move constructor

java - 有人可以解释 Java Thread 类中的 join 方法吗?

java - 在 Java/C++ 中创建类单例

java - Android线程问题(线程在后台运行)

c++ - 线程本地单例

delphi - 如何关闭ie8标签页

c++ - 在 Linux 上安装并运行 osgEarth

c++ - Netbeans C/C++ JavaDoc 代码完成