Properties:
| Name | Type | Description |
|---|---|---|
free |
number | [readonly] The amount of free workers. |
hardwareConcurrency |
number | [readonly] The maximum amount of concurrent threads supported by the hardware. |
pending |
number | [readonly] The amount of tasks that are either waiting or running. |
size |
number | (default: |
waiting |
number | [readonly] The amount of tasks that are waiting for a free worker. |
Extends
Methods
-
atomicInt32 (n)html.ThreadPool.AtomicInt32
-
Creates an atomic int32 for lock-free inter-thread communication. This feature may only be usable if the environment is cross origin isolated.
Name Type Description nnumber The initial value.
Returns:
Type Description html.ThreadPool.AtomicInt32 The atomic int32. -
postTask (code, parameters)html.ThreadPool.TaskHandle
-
Posts the given task to the next free worker thread and returns a TaskHandle object.
Transferable objects may be transfered (instead of being copied) to the worker thread by marking the parameter with
transfer().Functions may be passed as parameters to act as callbacks.
Name Type Description codestring The code to execute.
parametersArray.<any> repeatable The parameters.
Returns:
Type Description html.ThreadPool.TaskHandle The TaskHandle object for retrieving the result or an exception. -
postTaskFromSource (url, parameters)html.ThreadPool.TaskHandle
-
Posts the given task to the next free worker thread and returns a TaskHandle object.
Name Type Description urlstring The URL of the task to load.
parametersArray.<any> repeatable The parameters.
Returns:
Type Description html.ThreadPool.TaskHandle The TaskHandle object for retrieving the result or an exception. -
Marks the given transferable object for transfer instead of copying.
So far, HTML5 recognizes
ArrayBuffer,CanvasProxy,ImageBitmap, andMessagePortas transferable.Name Type Description objTransferable The object to mark for transfer.
Returns:
Type Description Transferable The object to transfer.