pythonic_global_lock 0.1.0

A globally locked mutex
Documentation
  • Coverage
  • 71.43%
    5 out of 7 items documented1 out of 7 items with examples
  • Size
  • Source code size: 7.3 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.7 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 16s Average build duration of successful builds.
  • all releases: 16s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Noratrieb/pythonic_global_lock
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Noratrieb

pythonic_global_lock

This crate provides a GLock<T>, that is globally locked. Every GLock<T> uses the same global lock, so locking on will lock all. Sounds like a dumb idea? One of the most popular programming implementations does it, so it must be smart.

fn main() {
    let lock1 = pythonic_global_lock::GLock::new(1);
    let lock2 = pythonic_global_lock::GLock::new(2);

    {
        let locked1 = lock1.lock();
        println!("{}", &*locked1)
        // locking lock2 here would be a deadlock
    }
}