Class: ThreadPool

ThreadPool(maxConcurrency)

Simple thread pool using the async library.

Constructor

new ThreadPool(maxConcurrency)

Construct the thread pool.
Parameters:
Name Type Description
maxConcurrency int maximum number of threads in the pool (default 1)
Source:

Methods

(async) awaitAll() → {Promise}

Await all functions to complete.
Source:
Returns:
resolves when all functions complete
Type
Promise

(async) submit(asyncFn) → {Promise}

Submit an asynchronous function to run using the thread pool.
Parameters:
Name Type Description
asyncFn function asynchronous function to run with the thread pool
Source:
Returns:
resolves when the function completes execution
Type
Promise