4 ms·
Happy to be corrected, but from what I gathered RWLock should mostly be avoided in favour of a simple Mutex unless you have a very read-heavy usecase and even t
by Sytten 2y ago
Happy to be corrected, but from what I gathered RWLock should mostly be avoided in favour of a simple Mutex unless you have a very read-heavy usecase and even then the performances are subpar compared to mutex.
- dathinab 2y agomaybe but that is unrelated to the distilled problem shown in the blog and RWLocks are not the only way this can bite you but it's also behavior for rust match-like statements in general so nothing new nor specific to if let
- kccqzy 2y agoI agree with you, but the problem the article is talking about is unexpected lifetime with `if let` which is not just limited to RwLock.
- roland35 2y agoI like to use rwlock on my code which reads once every few hours... Maybe I should change that!
- o11c 2y agoThe weirdest part about rwlock (not rust-specific) is when you end up using it in a case where the writes are the shared case and the reads are the exclusive case.