WorkerThread

Worker thread.

Constructor

new WorkerThread(parentPool)

Parameters:
NameTypeDescription
parentPoolThreadPool

The parent pool.

Members

id :string

Type:
  • string

onerror

Error event handler.

onmessage

Message event handler. For now assume we only get a single callback from a worker which also indicates the end of this worker.

parentPool :ThreadPool

runningTask :WorkerTask

worker :Worker

Type:
  • Worker

Methods

getId() → {string}

Get the thread ID.

Returns:

The thread ID (alphanumeric).

Type: 
string

run(workerTask)

Run a worker task.

Parameters:
NameTypeDescription
workerTaskWorkerTask

The task to run.

stop()

Finish a task and tell the parent.