brunoczim/fslock

File locking for Rust.

Rust

47

100 commits

updated Sep 23, 2025

See the code

README

fslock

API to use files as a lock. Supports non-std crates by disabling feature std.

Types

Currently, only one type is provided: [LockFile]. It does not destroy the file after closed and behaviour on locking different file handles owned by the same process is different between Unix and Windows, unless you activate the multilock feature, which enables the open_excl method that locks files per file descriptor/handle on all platforms.

Example

use fslock::LockFile;
fn main() -> Result<(), fslock::Error> {

    let mut file = LockFile::open("mylock")?;
    file.lock()?;
    do_stuff();
    file.unlock()?;

    Ok(())
}

Docs on Master

https://brunoczim.github.io/fslock/fslock

brunoczim/fslock

File locking for Rust.

Rust

47

100 commits

updated Sep 23, 2025

See the code

README

fslock

API to use files as a lock. Supports non-std crates by disabling feature std.

Types

Currently, only one type is provided: [LockFile]. It does not destroy the file after closed and behaviour on locking different file handles owned by the same process is different between Unix and Windows, unless you activate the multilock feature, which enables the open_excl method that locks files per file descriptor/handle on all platforms.

Example

use fslock::LockFile;
fn main() -> Result<(), fslock::Error> {

    let mut file = LockFile::open("mylock")?;
    file.lock()?;
    do_stuff();
    file.unlock()?;

    Ok(())
}

Docs on Master

https://brunoczim.github.io/fslock/fslock

Project health

Overall

2.9/10

Maintained

0/10

Code review

1/10
OpenSSF Scorecard

crates.io

Latest release

0.2.1 · Dec 20, 2021

Releases this year

0

Significant stargazers

Ivan Nikulin

332 followers · starred Jul 2023

Jérémie Drouet

237 followers · starred Apr 2025

AdheipSingh

47 followers · starred Jan 2022