ThreadPool

Constructor

new ThreadPool(poolSize)

Parameters:
NameTypeDescription
poolSizenumber

The size of the pool.

Classes

ThreadPool

Members

handleWorkerError

Handle an error message from a worker.

Methods

abort()

Abort all threads.

addWorkerTask(workerTask)

Add a worker task to the queue. Will be run when a thread is made available.

Parameters:
NameTypeDescription
workerTaskobject

The task to add to the queue.

onTaskEnd(workerThread)

Handle a task end.

Parameters:
NameTypeDescription
workerThreadobject

The thread to free.

onabort(_event)

Handle an abort event. Default does nothing.

Parameters:
NameTypeDescription
_eventobject

The abort event.

onerror(_event)

Handle an error event. Default does nothing.

Parameters:
NameTypeDescription
_eventobject

The error event.

onwork(_event)

Handle a work event. Default does nothing.

Parameters:
NameTypeDescription
_eventobject

The work event fired when a work ended successfully.

onworkend(_event)

Handle a work end event. Default does nothing.

Parameters:
NameTypeDescription
_eventobject

The work end event fired when a work has completed, successfully or not.

onworkitem(_event)

Handle a work item event. Default does nothing.

Parameters:
NameTypeDescription
_eventobject

The work item event fired when a work item ended successfully.

onworkstart(_event)

Handle a work start event. Default does nothing.

Parameters:
NameTypeDescription
_eventobject

The work start event.