Struct semaphore::Semaphore [] [src]

pub struct Semaphore<T> { /* fields omitted */ }

An atomic counter which can be shared across processes.

Methods

impl<T> Semaphore<T>
[src]

[src]

Create a new semaphore with the given limit.

[src]

Attempt to access the underlying resource of this semaphore.

This function will try to acquire access, and then return an RAII guard structure which will release the access when it falls out of scope.

If the semaphore is at limit or currently shutting down, a TryAccessError will be returned.

[src]

Shut down the semaphore.

This prevents any further access from being granted to the underlying resource.

As soon as the last access is released and the returned handle goes out of scope, the resource will be dropped.

Does not block until the resource is no longer in use. If you would like to do that, you can call wait on the returned handle.

Trait Implementations

impl<T> Clone for Semaphore<T>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more