Skip to main content
MessagePort.prototype.unref - worker_threads - Node documentation
method MessagePort.prototype.unref

Usage in Deno

import { MessagePort } from "node:worker_threads";
MessagePort.prototype.unref(): void

Calling unref() on a port allows the thread to exit if this is the only active handle in the event system. If the port is already unref()ed calling unref() again has no effect.

If listeners are attached or removed using .on('message'), the port is ref()ed and unref()ed automatically depending on whether listeners for the event exist.

Return Type

void