~asayers/multilockfile

769b0988f08d09024c9e16421c967743527086f9 — Alex Sayers 4 years ago 1e2db66 master
Add example
2 files changed, 13 insertions(+), 1 deletions(-)

A examples/lock.rs
M src/lib.rs
A examples/lock.rs => examples/lock.rs +12 -0
@@ 0,0 1,12 @@
use lockfile::*;

fn main() {
    let id: u32 = std::env::args().nth(1).unwrap().parse().unwrap();
    println!("Locking {}", id);
    let mut lock = Lock::new(id);
    lock.waitlock(false);
    println!("Got it!");
    loop {
        std::thread::sleep(std::time::Duration::from_secs(100));
    }
}

M src/lib.rs => src/lib.rs +1 -1
@@ 19,7 19,7 @@ lazy_static! {
            .write(true)
            .create(true)
            .mode(0o666)
            .open(".redo/locks")
            .open(".locks")
            .unwrap();
        Mutex::new(file)
    };