import { ThreadWorker } from "https://deno.land/x/poolifier@v0.3.14/src/worker/thread-worker.ts";
A thread worker used by a poolifier ThreadPool
.
When this worker is inactive for more than the given maxInactiveTime
,
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.
Constructors
new
ThreadWorker(taskFunctions: TaskFunction<Data, Response> | TaskFunctions<Data, Response>, opts?: WorkerOptions)Constructs a new poolifier thread worker.
Properties
private
optional
port: MessagePortMessage port used to communicate with the main worker.
protected
readonly
sendToMainWorker: (message: MessageValue<Response>) => voidMethods
protected
handleError(error: Error | string): stringprotected
handleKillMessage(message: MessageValue<Data>): voidprotected
handleReadyMessageEvent(messageEvent: MessageEvent<MessageValue<Data>>): void