Class: TaskHandle

TaskHandle

new html.ThreadPool.TaskHandle ()

A handle representing a particular task in the thread pool.

Methods

Creates an html.ThreadPool.AtomicInt32 object.

Name Type Description
n number

The number value.

Returns:
Type Description
html.ThreadPool.AtomicInt32 The AtomicInt32 object.

call (name)

Calls a function exported by a task and returns a Promise object.

You may pass callback functions as parameters. When the task invokes such a function, it will be executed in the context of the caller, i.e. outside the task.

Since callback functions may be called more than once, they are not freed while the task is running. In order to free a callback function immediately, have it return true explicitly.

Name Type Description
name string

The name of the function.

...parameters any repeatable

The parameters of the function.

catch (callback)

Connects a callback to be called when the task failed (i.e. aborted with an uncaught exception).

Name Type Description
callback function

The callback to connect.

then (callback)

Connects a callback to be called when the task finished.

Name Type Description
callback function

The callback to connect.

transfer (obj)Transferable

Marks an object for transfer to a task. This only has an effect if the object is transferable.

Name Type Description
obj object

The object to transfer.

Returns:
Type Description
Transferable The marked object.