Picos_std_sync.SemA poisonable counting semaphore.
đī¸ This uses a low overhead, optimistic, and unfair implementation. In most cases this should be the semaphore you will want to use.
See also Semaphore.
Maximum counter value allowed by the semaphore implementation.
âšī¸ The exact maximum value is unspecified, but should typically be no less than Sys.max_array_length.
val create : ?padded:bool -> int -> tcreate initial creates a new counting semaphore with the given initial count.
val release : t -> unitrelease sem increments the count of the semaphore or does nothing in case the semaphore has been poisoned.
âšī¸ This operation is not cancelable.
Exception raised in case the semaphore has been poisoned.
val acquire : t -> unitacquire sem waits until the count of the semaphore is greater than 0 and then atomically decrements the count.
val try_acquire : t -> booltry_acquire sem attempts to atomically decrement the count of the semaphore unless the count is already 0.
val get_value : t -> intget_value sem returns the current count of the semaphore or 0 in case the semaphore has been poisoned.
âšī¸ This should only be used for debugging or informational messages.
val poison : t -> unitpoison sem marks the semaphore as poisoned.