X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FThreadWorker.html;h=31732e8e68de2dd238bfefb8d2505588f5ee3a30;hb=71056a0ac555e096c1428d6341ef45c7980a6332;hp=957040c3cee2ec3ac6fe0dcd4e64b5593c9c286c;hpb=fe9f25b5ac98c7c7fccd1849a200c5054a77cf03;p=poolifier.git diff --git a/docs/classes/ThreadWorker.html b/docs/classes/ThreadWorker.html index 957040c3..a28b5056 100644 --- a/docs/classes/ThreadWorker.html +++ b/docs/classes/ThreadWorker.html @@ -1,13 +1,15 @@ -ThreadWorker | poolifier
+ThreadWorker | poolifier
-
+
-
+
  • poolifier
  • @@ -19,30 +21,33 @@ it will send a termination request to its main thread.

    If you use a DynamicThreadPool the extra workers that were created will be terminated, but the minimum number of workers will be guaranteed.

    +
+
+

Author

Alessandro Pio Ardizio

-

Template

of data this worker receives from pool's execution. This can only be serializable data.

- -

Template

of response the worker sends back to the main thread. This can only be serializable data.

- -

Author

Alessandro Pio Ardizio

- -

Since

0.0.1

+

Since

0.0.1

-
+

Type Parameters

-
    +
    • -

      Data = unknown

    • +

      Data = unknown

      +

      Type of data this worker receives from pool's execution. This can only be serializable data.

      +
      +
    • -

      Response = unknown

+

Response = unknown

+

Type of response the worker sends back to the main thread. This can only be serializable data.

+
+

Hierarchy

+
  • Defined in src/worker/thread-worker.ts:21
  • @@ -50,419 +55,432 @@ but the minimum number of workers will be guaranteed.

    Constructors

    -
    - -
      - +
      + +
        +
      • Constructs a new poolifier thread worker.

        -
        +

        Type Parameters

        -
          +
          • -

            Data = unknown

          • +

            Data = unknown

          • -

            Response = unknown

        +

        Response = unknown

      Parameters

      • -
        fn: ((data: Data) => Response)
        -

        Function processed by the worker when the pool's execution function is invoked.

        +
        taskFunctions: WorkerFunction<Data, Response> | TaskFunctions<Data, Response>
        +

        Task function(s) processed by the worker when the pool's execution function is invoked.

        -
          -
        • -
            -
          • (data: Data): Response
          • -
          • -
            -

            Parameters

            -
              +
            • -
              data: Data
            -

            Returns Response

      • -
      • -
        opts: WorkerOptions = {}
        +
        opts: WorkerOptions = {}

        Options for the worker.

        -
      -

      Returns ThreadWorker<Data, Response>

    +
    +

    Returns ThreadWorker<Data, Response>

    +
    +
  • Defined in src/worker/thread-worker.ts:31
  • Properties

    -
    - -
    aliveInterval?: Timeout
    -

    Handler Id of the aliveInterval worker alive check.

    -
    +
    + +
    isMain: boolean
    +

    Whether this is the main worker or not.

    +
    +
    +
    + +
    lastTaskTimestamp: number

    Timestamp of the last task processed by this worker.

    -
    +
    -
    - -
    mainWorker: undefined | null | MessagePort
    +
    + +
    mainWorker: undefined | null | MessagePort
    +

    Reference to main worker.

    +
    +
    -
    - -
    opts: WorkerOptions
    +
  • Defined in src/worker/abstract-worker.ts:76
  • +
    + +
    opts: WorkerOptions = ...

    Options for the worker.

    -
    +
  • Defined in src/worker/abstract-worker.ts:77
  • +
    + +
    statistics: WorkerStatistics
    +

    Performance statistics computation.

    +
    +
    +
    + +
    taskFunctions: Map<string, WorkerFunction<Data, Response>>
    +

    Task function(s) processed by the worker when the pool's execution function is invoked.

    +
    +

    Methods

    -
    - -
    +
    + +

    Parameters

    -

    Returns Func & { asyncResource: AsyncResource }

    -
    - -
    +
    + +
    -
    - -
    +
    + +
    -
    - -
    +
    + +
    -
    - -
    +
    + + +

    Returns string

    Message of the error.

    + +
    -
    - -
    -
    - -
    +
    + + +

    Returns void

    +
    -
    - -
    +
    + + +

    Returns void

    +
    -
    - -
    +
    + +

    Parameters

    +

    Returns Result

  • -
    Optional thisArg: This
    +
    Optional thisArg: This

    The receiver to be used for the function call.

    -
  • + +
  • -
    Rest ...args: any[]
    +
    Rest ...args: any[]

    Optional arguments to pass to the function.

    -
  • -

    Returns Result

    +
    + +
    +
    + + +

    Returns void

    +
    -
    - -
    +
    + +
    -
    - -
    +
    + +

    Parameters

    +
  • -
    Optional type: string
    +
    Optional type: string

    An optional name to associate with the underlying AsyncResource.

    -
  • + +
  • -
    Optional thisArg: ThisArg
  • -

    Returns Func & { asyncResource: AsyncResource }

    +
    +
    +
    +

    On This Page

    - -
    +
  • constructor
  • +
  • aliveInterval
  • +
  • isMain
  • +
  • lastTaskTimestamp
  • +
  • mainWorker
  • +
  • opts
  • +
  • statistics
  • +
  • taskFunctions
  • +
  • asyncId
  • +
  • bind
  • +
  • checkAlive
  • +
  • emitDestroy
  • +
  • getMainWorker
  • +
  • handleError
  • +
  • messageListener
  • +
  • runAsync
  • +
  • runInAsyncScope
  • +
  • runSync
  • +
  • sendToMainWorker
  • +
  • triggerAsyncId
  • +
  • bind
  • + +

    Generated using TypeDoc

    -
    \ No newline at end of file +
    \ No newline at end of file