| Crates.io | bitcoinleveldb-sync |
| lib.rs | bitcoinleveldb-sync |
| version | 0.1.19 |
| created_at | 2023-01-19 07:18:54.268596+00 |
| updated_at | 2025-12-01 17:55:50.843193+00 |
| description | Rust crate for efficient, scoped synchronization using 'parking_lot' raw mutexes. |
| homepage | |
| repository | https://github.com/klebs6/bitcoin-rs |
| max_upload_size | |
| id | 762376 |
| size | 176,691 |
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.
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.
MutexLock is scoped, automatically releasing the lock when it goes out of scope, preventing deadlocks.parking_lot for highly efficient lock operations suitable for performance-critical applications.Here is an example of using MutexLock:
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.
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.
Contributions and issues are welcome. Please see the repository for more information.