docs: fix comments

This commit is contained in:
2021-03-09 16:53:20 +01:00
parent 23ec4ff99b
commit 057f3e1f0d
2 changed files with 3 additions and 3 deletions

View File

@@ -204,8 +204,6 @@ pub struct Core<S, ST, C, KC> {
storage: ST, storage: ST,
cryptor: C, cryptor: C,
key_cryptor: KC, key_cryptor: KC,
// use sync `std::sync::Mutex` here because it has less overhead than async mutex, we are
// holding it for a very shot time and do not `.await` while the lock is held.
data: LockBox<CoreMutData<S>>, data: LockBox<CoreMutData<S>>,
supported_data_versions: Vec<Uuid>, supported_data_versions: Vec<Uuid>,
current_data_version: Uuid, current_data_version: Uuid,

View File

@@ -126,7 +126,9 @@ where
Ok(()) Ok(())
} }
/// Prevents `await`s while the lock is held. Awaiting could cause deadlocking. /// Uses sync `std::sync::Mutex` because it has less overhead than async mutex. Its intended use is
/// for short data accesses. Prevents `await`s while the lock is held. Awaiting could cause
/// deadlocking.
#[derive(Debug)] #[derive(Debug)]
pub struct LockBox<T> { pub struct LockBox<T> {
inner: SyncMutex<T>, inner: SyncMutex<T>,