[src]

Struct sync::raw::Semaphore

pub struct Semaphore {
    // some fields omitted
}

A counting, blocking, bounded-waiting semaphore.

Methods

impl Semaphore

fn new(count: int) -> Semaphore

Create a new semaphore with the specified count.

fn acquire(&self)

Acquire a resource represented by the semaphore. Blocks if necessary until resource(s) become available.

fn release(&self)

Release a held resource represented by the semaphore. Wakes a blocked contending task, if any exist. Won't block the caller.

fn access<'a>(&'a self) -> SemaphoreGuard<'a>

Acquire a resource of this semaphore, returning an RAII guard which will release the resource when dropped.