SemaphoreModule

PackageAxial
Flow-native semaphore helpers.

Summary

NameSignatureSynopsis
makeSemaphore.make permitsCreates a semaphore with the supplied initial permit count.
withPermitSemaphore.withPermit (FlowSemaphore queue) flowRuns a workflow while holding one permit and always releases the permit afterward.

make

Semaphore.make permits
Member
Creates a semaphore with the supplied initial permit count.

Parameters

NameTypeDescription
permitsint

Returns

Flow<'env, 'error, FlowSemaphore>

withPermit

Semaphore.withPermit (FlowSemaphore queue) flow
Member
Runs a workflow while holding one permit and always releases the permit afterward.

Parameters

NameTypeDescription
FlowSemaphore queueFlowSemaphore
flowFlow<'env, 'error, 'value>

Returns

Flow<'env, 'error, 'value>