Simple Lock
NOTE: Still a WIP package.
This package provides a simple locking abstraction for inter-process/thread synchronization.
Features:
By default, no features will be enabled and only the Lock trait and utility functionality will be available. This can be useful if you wish to hand-roll your own Lock, but don't want to re-write the utility functions.
Current implementations:
fake- Enables the FakeLock implementation module (useful for testing only).file- Enables the FileLock implementation module (most common and cross-platform).sema- Enables the SemaphoreLock implementation module (nix only).
Examples:
use *;
If you wanted to implement your own lock, you can implement the Lock trait and use it with all the same utility functionality provided by this package. If you do not enable any features, this package is only the trait and utility functions.
Caveats:
If you are ok with the below, then go ahead and use this package.
unsafe- The "semaphore" lock implementation has unsafe code, this is because the nix package does not have implementations for POSIX semaphores yet. If this is unacceptable, don't enable the "semaphore" feature.no_std- We currently do not have any non-stdlib available lock implementations.