Module tokio_sync::semaphore
source · [−]Expand description
Thread-safe, asynchronous counting semaphore.
A Semaphore
instance holds a set of permits. Permits are used to
synchronize access to a shared resource.
Before accessing the shared resource, callers acquire a permit from the
semaphore. Once the permit is acquired, the caller then enters the critical
section. If no permits are available, then acquiring the semaphore returns
NotReady
. The task is notified once a permit becomes available.
Structs
Error returned by Permit::poll_acquire
.
A semaphore permit
Futures-aware semaphore.
Error returned by Permit::try_acquire
.