tokio-rs / loom

Concurrency permutation testing tool for Rust.
MIT License
2.08k stars 110 forks source link

Add lock_arc API to loom Mutex #330

Open culldanx opened 1 year ago

culldanx commented 1 year ago

ref: https://docs.rs/lock_api/latest/lock_api/struct.Mutex.html#method.lock_arc

If, for example, Mutexes are dynamically generated and stored somewhere, putting them in an Arc adds assurance that even if something mutates the storage (e.g a hashmap), sections of code that have already read and locked the mutex will still hold valid MutexGuards. This is not normally possible due to lifetime constraints