klyn.threading.Semaphore.Semaphore
constructor

    public Semaphore(permits as Int = 1):

Description

Creates a semaphore with an initial number of permits.

Zero creates a closed semaphore: `acquire()` blocks until another thread calls `release()`.

Parameters

Parameter | Description
--- | ---
`permits` | Initial number of available permits.

Throws

- ValueException if `permits` is negative.

Example

ready = Semaphore(0) worker.start() ready.acquire()