How to unlock a rwlock? I can't drop the lock since i need it more than 1 time. I have some code like this:
struct Abc { lock: RwLock<()>, data: usize, } let a = Abc { RwLock::new(()), data: 0, }; a.lock.read().unwrap(); // do something with data // now i need to unlock a.lock so others threads can use it
As @Michael Anderson said, the RwLock is unlocked when the guards is dropped, not the RwLock itself.
2.1m questions
2.1m answers
60 comments
56.9k users