Struct shared_mutex::monitor::Monitor [] [src]

pub struct Monitor<T: ?Sized> { /* fields omitted */ }

A convenience wrapper around a SharedMutex and a Condvar.

Provides an ergonomic API for locking and waiting on predicates associated with the internal data.

Methods

impl<T> Monitor<T>
[src]

Create a new Monitor.

impl<T: ?Sized> Monitor<T>
[src]

Acquire a shared read lock on the monitor.

Acquire an exclusive write lock on the monitor.

Notify one thread which is waiting on the monitor.

Note that it is safe but often incorrect to notify without holding any lock on the monitor, since the predicate may change between a notification and a predicate check, potentially causing a deadlock.

Notify all threads which are waiting on the monitor.

Note that it is safe but often incorrect to notify without holding any lock on the monitor, since the predicate may change between a notification and a predicate check, potentially causing a deadlock.

Get a reference to the condition variable in this Monitor for external use.

Trait Implementations

impl<T: ?Sized> AsRef<SharedMutex<T>> for Monitor<T>
[src]

Performs the conversion.

impl<T: ?Sized> AsMut<SharedMutex<T>> for Monitor<T>
[src]

Performs the conversion.

impl<T> Into<SharedMutex<T>> for Monitor<T>
[src]

Performs the conversion.

impl<T: ?Sized + Debug> Debug for Monitor<T>
[src]

Formats the value using the given formatter.