Struct std::sync::Mutex [] [src]

pub struct Mutex<T: ?Sized> {
    lock: AtomicBool,
    value: UnsafeCell<T>,
}

A mutex, i.e. a form of safe shared memory between threads. See rust std's Mutex.

Fields

lock
value

Methods

impl<T> Mutex<T>

fn new(value: T) -> Self

Create a new mutex with value value.

impl<T: ?Sized> Mutex<T>

fn lock(&self) -> Result<MutexGuard<T>, ()>

Lock the mutex

Trait Implementations

impl<T: ?Sized + Send> Send for Mutex<T>

impl<T: ?Sized + Send> Sync for Mutex<T>