pub unsafe trait Lockable<'a> {
type Output;
// Required methods
fn get_ptrs(&self) -> Vec<usize>;
unsafe fn lock(&'a self) -> Self::Output;
unsafe fn try_lock(&'a self) -> Option<Self::Output>;
}Expand description
A type that may be locked and unlocked
§Safety
A deadlock must never occur. The unlock method must correctly unlock the
data. The get_ptrs method must be implemented correctly. The Output
must be unlocked when it is dropped.
Required Associated Types§
Required Methods§
sourcefn get_ptrs(&self) -> Vec<usize>
fn get_ptrs(&self) -> Vec<usize>
Returns a list of all pointers to locks. This is used to ensure that the same lock isn’t included twice