Constructor
new ThreadPool(poolSize)
Name | Type | Description |
---|---|---|
poolSize | number | The size of the pool. |
- Source
Classes
Members
handleWorkerError
Handle an error message from a worker.
- Source
Methods
abort()
Abort all threads.
- Source
addWorkerTask(workerTask)
Add a worker task to the queue. Will be run when a thread is made available.
Name | Type | Description |
---|---|---|
workerTask | object | The task to add to the queue. |
- Source
onTaskEnd(workerThread)
Handle a task end.
Name | Type | Description |
---|---|---|
workerThread | object | The thread to free. |
- Source
onabort(_event)
Handle an abort event. Default does nothing.
Name | Type | Description |
---|---|---|
_event | object | The abort event. |
- Source
onerror(_event)
Handle an error event. Default does nothing.
Name | Type | Description |
---|---|---|
_event | object | The error event. |
- Source
onwork(_event)
Handle a work event. Default does nothing.
Name | Type | Description |
---|---|---|
_event | object | The work event fired when a work ended successfully. |
- Source
onworkend(_event)
Handle a work end event. Default does nothing.
Name | Type | Description |
---|---|---|
_event | object | The work end event fired when a work has completed, successfully or not. |
- Source
onworkitem(_event)
Handle a work item event. Default does nothing.
Name | Type | Description |
---|---|---|
_event | object | The work item event fired when a work item ended successfully. |
- Source
onworkstart(_event)
Handle a work start event. Default does nothing.
Name | Type | Description |
---|---|---|
_event | object | The work start event. |
- Source