X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fworker.ts;h=2da91457aed58994f01714a162adffba69ab61fe;hb=15a8bf08edd98c1f9ef4a4d3f89d2cffbe30852e;hp=507396dea078ac806c5dda839336f6046df11d5c;hpb=20016c79549983d09d30b70852ec7fae515d4156;p=poolifier.git diff --git a/src/pools/worker.ts b/src/pools/worker.ts index 507396de..2da91457 100644 --- a/src/pools/worker.ts +++ b/src/pools/worker.ts @@ -1,3 +1,4 @@ +import type { MessageChannel } from 'node:worker_threads' import type { CircularArray } from '../circular-array' import type { Task } from '../utility-types' @@ -105,8 +106,8 @@ export interface TaskStatistics { * Enumeration of worker types. */ export const WorkerTypes = Object.freeze({ - cluster: 'cluster', - thread: 'thread' + thread: 'thread', + cluster: 'cluster' } as const) /** @@ -136,6 +137,10 @@ export interface WorkerInfo { * Ready flag. */ ready: boolean + /** + * Message channel. + */ + messageChannel?: MessageChannel } /** @@ -237,6 +242,10 @@ export interface IWorkerNode { * Resets usage statistics . */ readonly resetUsage: () => void + /** + * Close communication channel. + */ + readonly closeChannel: () => void /** * Gets task worker usage statistics. */