X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fpools%2Fworker.ts;h=d40754835ab040d7fd8f947238bb9b857c6d58a6;hb=8b58b2c79d34d814340c13824a415595c2476bba;hp=05f6606edde672db081d9f392e9584ebc7a917f7;hpb=a4791fb12ff22711bc4bf1bcae4231ca7d6c7974;p=poolifier.git diff --git a/src/pools/worker.ts b/src/pools/worker.ts index 05f6606e..d4075483 100644 --- a/src/pools/worker.ts +++ b/src/pools/worker.ts @@ -235,6 +235,12 @@ export interface IWorker extends EventEmitter { * @param handler - The event handler. */ readonly once: (event: string, handler: EventHandler) => this + /** + * Calling `unref()` on a worker allows the thread to exit if this is the only + * active handle in the event system. If the worker is already `unref()`ed calling`unref()` again has no effect. + * @since v10.5.0 + */ + readonly unref?: () => void /** * Stop all JavaScript execution in the worker thread as soon as possible. * Returns a Promise for the exit code that is fulfilled when the `'exit' event` is emitted.