Trait flexible_locks::RawMutex [] [src]

pub trait RawMutex: Send + Sync {
    unsafe fn lock(&self);
unsafe fn unlock(&self); unsafe fn init(&mut self) { ... }
unsafe fn destroy(&self) { ... } }

A trait for raw mutual exclusion primitives.

Required Methods

Acquire the raw mutex.

Release the raw mutex.

Provided Methods

Initialize the raw mutex.

Because initializing an instance may involve moving its location when doing e.g. Box::new(Foo::new()), because some types of raw mutex primitives need to be initialized at their final, permanent location (e.g. CRITICAL_SECTION), or because some may not be statically initialized to an entirely satisfying state (e.g. pthread_mutex_t, see issue #33770), this method is called from [Mutex::new] to finish the raw mutex initialization.

Destroy the raw mutex.

In some cases, raw mutex primitives need to be cleaned up after use, so this method is called when a [Mutex] is dropped.

Implementations on Foreign Types

impl<T: RawMutex> RawMutex for Box<T>
[src]

Wrapping a RawMutex in a Box is just as good a valid RawMutex.

Ideally, any type that derefs to a RawMutex would be good too, but without specialization, this would prevent implementing RawMutex on your own mutex types.

[src]

[src]

[src]

[src]

Implementors