parking_lot_core::parking_lot

Function lock_bucket_pair

Source
fn lock_bucket_pair(
    key1: usize,
    key2: usize,
) -> (&'static Bucket, &'static Bucket)
Expand description

Locks the two buckets for the given pair of keys and returns references to them. The returned buckets must be unlocked again in order to not cause deadlocks.

If both keys hash to the same value, both returned references will be to the same bucket. Be careful to only unlock it once in this case, always use unlock_bucket_pair.