Class: Worker

Worker

new html.ThreadPool.Worker ()

The worker environment in the thread pool.

Tasks in the thread pool have access to the functions of this environment.

Classes

AtomicInt32

Methods

html.ThreadPool.Worker.exit () static

Exits the task manually.

html.ThreadPool.Worker.importWasm ()Promise static

Imports (Emscripten) WebAssembly from the given URL.

Properties:
Name Type Description
wasmUrl string

The URL where to load the WebAssembly from.

Returns:
Type Description
Promise A Promise resolving to the runtime instance.

html.ThreadPool.Worker.proxyObject (obj)object static

Creates a proxy for calling methods of the given object by another thread.

Name Type Description
obj object

The object.

Returns:
Type Description
object A proxy object for passing to other threads.

html.ThreadPool.Worker.shRequire () static

The Shellfish module management is available in tasks.

See:
  • shRequire

html.ThreadPool.Worker.sleep () static

Puts the worker thread to sleep for the given amount of milliseconds.

If the platform does not support Atomics, this function will perform a busy wait instead.

html.ThreadPool.Worker.transfer (obj)Transferable static

Marks the given transferable object for transfer instead of copying.

So far, HTML5 recognizes ArrayBuffer, CanvasProxy, ImageBitmap, and MessagePort as transferable.

Name Type Description
obj Transferable

The object to mark for transfer.

Returns:
Type Description
Transferable The object to transfer.