Thread pool with a constant amount of threads. Threads in the pool will exist until the pool is explicitly shut down.

Constructor

new(threadsCount:Int)

Create a new thread pool with threadsCount threads.

Variables

read onlyisShutdown:Bool

Indicates if shutdown method of this pool has been called.

read onlythreadsCount:Int

Methods

run(task:() ‑> Void):Void

Submit a task to run in a thread.

Throws an exception if the pool is shut down.

shutdown():Void

Initiates a shutdown. All previousely submitted tasks will be executed, but no new tasks will be accepted.

Multiple calls to this method have no effect.