[issue42590] Something like Rust's std::sync::Mutex – combining a mutex primitive and a piece of data it's protecting

2020-12-07 Thread STINNER Victor
Change by STINNER Victor : -- nosy: -vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42590] Something like Rust's std::sync::Mutex – combining a mutex primitive and a piece of data it's protecting

2020-12-07 Thread Jakub Stasiak
New submission from Jakub Stasiak : I've been wondering if it's worth it to have something like Rust's std::sync::Mutex[1] which is used like this: let data = Mutex::new(0); { let mut unlocked = data.lock().unwrap(); *unlocked += 1; } // unlocked is no longer