# bitcoinleveldb-sync
`bitcoinleveldb-sync` is a Rust library designed for synchronizing access to resources using a custom lock mechanism. This crate utilizes low-level, high-performance locking principles and is ideal for scenarios that require precise, synchronous control over concurrency.
## Overview
This crate provides a synchronization primitive: `MutexLock`, which relies on a low-level `parking_lot::RawMutex`. This allows for more granular control over locking behavior compared to standard library mutexes. Users are responsible for ensuring correctness when employing these advanced locking techniques.
### Core Features
- **Scoped Locking**: The `MutexLock` is scoped, automatically releasing the lock when it goes out of scope, preventing deadlocks.
- **High-Performance**: Utilizing `parking_lot` for highly efficient lock operations suitable for performance-critical applications.
### Usage
Here is an example of using `MutexLock`:
```rust
use parking_lot::RawMutex;
let raw_mutex = RawMutex::INIT;
{
let _lock = bitcoinleveldb_sync::MutexLock::new(&raw_mutex);
// critical section
}
// The lock is automatically released here.
```
### Safety
- The `MutexLock` requires users to provide raw pointers to `parking_lot::RawMutex`. Proper pointer management and safety practices are expected.
- **Panic Safety**: The constructor will panic if given a null pointer.
## Contributing
Contributions and issues are welcome. Please see the [repository](https://github.com/klebs6/bitcoin-rs) for more information.