Skip to main content

lock

Function lock 

Source
pub fn lock<'m, T: ?Sized>(
    mutex: &'m Mutex<T>,
    what: &'static str,
) -> Result<MutexGuard<'m, T>, LockError>
Expand description

Lock mutex, which guards what, such as “the build’s warnings”, waiting at most LOCK_PATIENCE while another holder keeps it.

§Errors

A LockError that names what when the lock stays held for LOCK_PATIENCE, such as a lock that the calling thread holds itself.