Struct try_lock::TryLock [] [src]

pub struct TryLock<T> { /* fields omitted */ }

A light-weight lock guarded by an atomic boolean.

Most efficient when contention is low, acquiring the lock is a single atomic swap, and releasing it just 1 more atomic swap.

It is only possible to try to acquire the lock, it is not possible to wait for the lock to become ready, like with a Mutex.

Methods

impl<T> TryLock<T>
[src]

[src]

Create a TryLock around the value.

[src]

Try to acquire the lock of this value.

If the lock is already acquired by someone else, this returns None. You can try to acquire again whenever you want, perhaps by spinning a few times, or by using some other means of notification.

Trait Implementations

impl<T: Send> Send for TryLock<T>
[src]

impl<T: Send> Sync for TryLock<T>
[src]

impl<T: Debug> Debug for TryLock<T>
[src]

[src]

Formats the value using the given formatter. Read more