Skip to main content

ordered_lock

Function ordered_lock 

Source
pub fn ordered_lock<'a, M: MutexLike>(
    m1: &'a M,
    m2: &'a M,
) -> (M::Guard<'a>, M::Guard<'a>)
Expand description

Lock m1 and m2 in a consistent order (using the memory address of m1 and m2 and returns the associated guard. This ensure that ordered_lock(m1, m2) and ordered_lock(m2, m1) will not deadlock.