port.unref()


如果这是事件系统中唯一的活动句柄,则在端口上调用 unref() 将允许线程退出。 如果端口已经 unref(),则再次调用 unref() 将无效。

如果使用 .on('message') 绑定或删除监听器,则端口将根据事件的监听器是否存在自动进行 ref()unref()

Calling unref() on a port will allow 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 will have no effect.

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