I have several threads waiting on the same Condvar
associated with data wrapped inside a RwLock
. I'd like to call Condvar::wait
and check a condition after holding the write lock to the data, but it seems Condvar::wait
only accepts MutexGuard
as an argument. Since there are many other parts that use this data as a read-only variable, I can't simply replace RwLock
with Mutex
.
How should I use Condvar
together with RwLock
-wrapped data?
见https://github.com/Amanieu/parking_lot/issues/165用于使用的示例CondVar
用RwLockGuard
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.