bitcoinleveldb-sync 0.1.19

Rust crate for efficient, scoped synchronization using 'parking_lot' raw mutexes.
docs.rs failed to build bitcoinleveldb-sync-0.1.19
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: bitcoinleveldb-sync-0.1.16-alpha.0

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:

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 for more information.