gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 01:18:53 37 4
gpt4 key购买 nike

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

我在 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/

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