Expand description

timed-locks is a set of smart pointers to tokio::sync locks that can be used as drop-in replacement and will panic after a given timeout when the lock cannot be acquired. Default timeout is 30 seconds. Failsafe mechanism to give your service a chance to recover from a deadlock.

Example

Deadlock that panics after 30 seconds:

let lock = timed_locks::RwLock::new(std::collections::HashSet::<usize>::new());
let _lock = lock.read().await;
lock.write();

Structs

Smart pointer to tokio::sync::Mutex.

Smart pointer to tokio::sync::RwLock.

Enums

Timed locks errors.

Constants

Duration constant of 30 seconds for the default timeout.

Type Definitions

Custom result.