Each and every one of the USES I envisioned for the lightweight reader-writer lock was instead implemented using RCU.
不过任何一个想到的轻量级读写锁最后都是使用rcu的替代实现而已。
That is, it would be more efficient to allow readers to run while other readers held the lock, but you'd risk a constant stream of reader threads keeping the writer from ever doing its job.
即,允许一些读取器在其他读取器锁定时运行效率更高,但是您可能会有读取器线程的流持续不断的风险,导致编写器无法进行工作。
Obviously, if your use of the lock is reader/writer in nature, this spinlock should be used over the standard spinlock, which doesn't differentiate between readers and writers.
显然,如果您使用的是原版的读/写锁,那么按照标准自旋锁的用法使用这个自旋锁,而不区分读线程和写线程。
Upgrades a reader lock to the writer lock.
读取器锁定升级至写入器锁定。
Upgrades a reader lock to the writer lock.
读取器锁定升级至写入器锁定。
应用推荐