port.unref()
如果这是事件系统中唯一的活动句柄,则在端口上调用 unref()
允许线程退出。
如果端口已经 unref()
,则再次调用 unref()
无效。
如果使用 .on('message')
绑定或删除监听器,则根据事件的监听器是否存在,端口将自动进行 ref()
和 unref()
。
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.