Method lrs::sync::Condvar::wait2

Atomically unlocks a mutex guard and waits for a signal on this condvar.

Syntax

impl Condvar {
    fn wait2<T, U>(&self, mutex: &'a Mutex<T>, guard: MutexGuard<'b, U>) -> MutexGuard<'a, T>
}

Arguments

NameDescription
mutex

The mutex to be locked before returning.

guard

The mutex guard to be unlocked.

Return value

Returns a guard created by locking the mutex argument.

Remarks

While the condition variable is in use, the condition variable can only be used with the same mutex. The condition variable is in use while there are users waiting on it. If the condition variable is used with another a mutex, the process is aborted.

The mutex in question in the above paragraph is the mutex passed as the mutex argument. The guard argument doesn't have to be related to the mutex in any way.