1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
use cluFlock::ExclusiveFlock; use std::fs::File; fn main() -> Result<(), std::io::Error> { let file = File::create("./file")?; { let file_lock = ExclusiveFlock::wait_lock(&file)?; // file_lock, type: FlockLock<&File> println!("{:?}", file_lock); } // auto unlock ExclusiveFlock file.sync_all()?; Ok( () ) }