Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IWorkerThread

Abstraction of a thread that is used to execute a ITask. A worker thread can execute one ITask at a time. It may consist of two parts. The worker thread that resists in the main thread and acts as facade to the underlining worker slave. The worker slave executes the tasks scheduled on the worker thread in a dedicated environment, e.g. a web worker or child process. The worker slave normally does not resist in the main thread memory and communicates with the worker thread using messaging

Acts as abstraction of the actually used environment (node, browser...)

Hierarchy

  • IWorkerThread

Implemented by

Index

Properties

Methods

Properties

id

id: number

Unique id of this worker thread

Methods

run

  • Executes the given task on this worker thread. The given callback is invoked when the task has completed

    Parameters

    • task: ITaskDefinition

      the task to execute

    • callback: function

      the callback to invoke when the execution has complted. The callback is invoked either with an error or a result, depending on the outocome of the execution

        • (error: any, result: any): void
        • Parameters

          • error: any
          • result: any

          Returns void

    Returns void

stop

  • stop(): void
  • Stops the worker as soon as possible. An already started task on this worker thread might be interrupted or is prevented from starting at all.

    Returns void

Generated using TypeDoc