Skip to main content

Module semaphore

Module semaphore 

Source
Expand description

N-permit gate — mirrors Effect.ts concurrency primitives backed by tokio::sync::Semaphore.

Use Semaphore::acquire with crate::resource::scope::Scope as the effect environment R so the permit is released when the scope is closed (via a Scope finalizer). Semaphore::try_acquire returns an owned Permit that releases on drop instead.

Structs§

Permit
Proof of holding one semaphore permit, or an owned handle that releases on Drop.
Semaphore
N-permit async semaphore (shared handle).

Functions§

acquire
Semaphore.acquire(sem)
acquire_owned
Semaphore.acquire_owned(sem)
available
Semaphore.available(sem)
make
Semaphore.make(n)
try_acquire
Semaphore.try_acquire(sem)