Struct rustrt::exclusive::Exclusive[src]

pub struct Exclusive<T> {
    // some fields omitted
}

An OS mutex over some data.

This is not a safe primitive to use, it is unaware of the libgreen scheduler, as well as being easily susceptible to misuse due to the usage of the inner NativeMutex.

Note: This type is not recommended for general use. The mutex provided as part of libsync should almost always be favored.

Methods

impl<T: Send> Exclusive<T>

fn new(user_data: T) -> Exclusive<T>

Creates a new Exclusive which will protect the data provided.

unsafe fn lock<'a>(&'a self) -> ExclusiveGuard<'a, T>

Acquires this lock, returning a guard which the data is accessed through and from which that lock will be unlocked.

This method is unsafe due to many of the same reasons that the NativeMutex itself is unsafe.