tinystore 0.2.0-rc.1

A small storage runtime for applications on SQLite: SQL, key-value state, durable jobs, files, search, logs and metrics in one directory
Documentation
1
2
3
4
5
6
7
8
9
//! What every part of the store takes a mutex with.

use std::sync::{Mutex, MutexGuard, PoisonError};

/// Takes `mutex`, poisoned or not: a panic is caught where it happens, and
/// whoever holds the lock next goes on with what the mutex holds.
pub(crate) fn lock<T>(mutex: &Mutex<T>) -> MutexGuard<'_, T> {
    mutex.lock().unwrap_or_else(PoisonError::into_inner)
}