๐ Rust Mutex
= a lock on data access
How?
Normal
Mutex<T>->Mutex::new(T).lock()to acquire the lock- blocks until mutex is obtained
- returns
MutexGuard<T> - released when variable is dropped
Read, write
RwLock.write()waits for exclusive, mut access- -> max one writer
.read()waits for non-mut access- -> many readers
Conditional
std::sync::Condvar.wait()-> block thread.notify_all()-> releases blocked (via.wait()) thread