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.

Inherited Properties
property Inherited Properties 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.

Inherited Methods
method Inherited Methods from Object: deepCopy, fromJson, toDict, toJson, toString, toXml
method Inherited Methods from AutoClosable: close