Semaphore
class in package klyn.threading

    public class Semaphore extends Object implements AutoClosable:

Object
└ Semaphore
All Implemented Interfaces: AutoClosable

Counting semaphore.

`acquire()` blocks until a permit is available and returns an AutoClosable guard so the permit can be released automatically in a `try` block.

Properties inherited from Object: type
Constructors

Modifier and Type | Member | Description
--- | --- | ---
public | Semaphore `Semaphore(permits as Int = 1):` | Creates a semaphore with an initial number of permits.

Methods

Modifier and Type | Member | Description
--- | --- | ---
public | acquire `acquire() as Semaphore:` | Acquires one permit and returns an AutoClosable guard.
public | close `close() as Void:` | AutoClosable support for try-with-resources.
public | release `release() as Void:` | Releases one permit.

Methods inherited from Object: fromJson, toDict, toJson, toString, toXml
Methods inherited from AutoClosable: close