X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FThreadWorker.html;h=1ecc9fd9de18ddeed0766056183d7ce25fcbb3aa;hb=e39450c0889208d6dcde666fc05b95fe7a98ee29;hp=a4c0ee80c6aec47c63e2262922a1df9973a6456e;hpb=7e2a464b15953320c79646e2ff88d953db4e5b96;p=poolifier.git diff --git a/docs/classes/ThreadWorker.html b/docs/classes/ThreadWorker.html index a4c0ee80..1ecc9fd9 100644 --- a/docs/classes/ThreadWorker.html +++ b/docs/classes/ThreadWorker.html @@ -1,13 +1,15 @@ -ThreadWorker | poolifier
+ThreadWorker | poolifier
-
+
-
+
  • poolifier
  • @@ -20,10 +22,6 @@ 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.

    -

    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

    @@ -32,17 +30,21 @@ but the minimum number of workers will be guaranteed.

    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
  • @@ -55,9 +57,10 @@ but the minimum number of workers will be guaranteed.

    Properties

    Methods

    @@ -80,7 +83,7 @@ but the minimum number of workers will be guaranteed.

      - +
    • Constructs a new poolifier thread worker.

      @@ -95,38 +98,46 @@ but the minimum number of workers will be guaranteed.

      Parameters

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

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

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

            • -
              data: Data
            -

            Returns Response

      • +
        data: Data
    +

    Returns Response

  • opts: WorkerOptions = {}

    Options for the worker.

  • -

    Returns ThreadWorker<Data, Response>

    Properties

    aliveInterval?: Timeout
    -

    Handler Id of the aliveInterval worker alive check.

    +

    Handler id of the aliveInterval worker alive check.

    +
  • Defined in src/worker/abstract-worker.ts:31
  • +
    + +
    isMain: boolean
    +

    Whether this is the main worker or not.

    +
    lastTaskTimestamp: number
    @@ -134,21 +145,23 @@ but the minimum number of workers will be guaranteed.

    +
  • Defined in src/worker/abstract-worker.ts:27
  • -
    mainWorker: undefined | null | MessagePort
    -
    - - +
  • Defined in src/worker/abstract-worker.ts:45
  • +
    + +
    opts: WorkerOptions = ...

    Options for the worker.

    +
  • Defined in src/worker/abstract-worker.ts:46
  • Methods

    @@ -162,11 +175,11 @@ but the minimum number of workers will be guaranteed.

    Returns number

    +
  • Defined in node_modules/.pnpm/@types+node@18.15.11/node_modules/@types/node/async_hooks.d.ts:315
  • +
  • Defined in node_modules/.pnpm/@types+node@18.15.11/node_modules/@types/node/async_hooks.d.ts:288
  • +
  • Defined in src/worker/abstract-worker.ts:146
  • +
  • Defined in node_modules/.pnpm/@types+node@18.15.11/node_modules/@types/node/async_hooks.d.ts:311
  • +
  • Defined in src/worker/abstract-worker.ts:129
  • +
  • Defined in src/worker/abstract-worker.ts:161
  • +

    Returns Response

    Returns void

    +
  • Defined in src/worker/abstract-worker.ts:84
  • -
    value: MessageValue<Data, unknown>
    +
    message: MessageValue<Data, unknown>

    Input data for the given function.

  • Returns void

    +
  • Defined in src/worker/abstract-worker.ts:171
  • -
    value: MessageValue<Data, unknown>
    +
    message: MessageValue<Data, unknown>

    Input data for the given function.

  • Returns void

    +
  • Defined in src/worker/abstract-worker.ts:198
  • -
    Optional thisArg: This
    +
    Optional thisArg: This

    The receiver to be used for the function call.

  • Rest ...args: any[]

    Optional arguments to pass to the function.

  • -

    Returns Result

    +
  • Defined in node_modules/.pnpm/@types+node@18.15.11/node_modules/@types/node/async_hooks.d.ts:303
  • +
  • Defined in src/worker/thread-worker.ts:36
  • +
  • Defined in node_modules/.pnpm/@types+node@18.15.11/node_modules/@types/node/async_hooks.d.ts:320
  • Parameters

    -

    Returns Func & { asyncResource: AsyncResource }

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

    Generated using TypeDoc

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