mirror of
https://github.com/nodejs/node.git
synced 2025-05-02 03:31:35 +00:00

Fixes: https://github.com/nodejs/node/issues/26167 PR-URL: https://github.com/nodejs/node/pull/26170 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
13 lines
442 B
JavaScript
13 lines
442 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const { Worker } = require('worker_threads');
|
|
|
|
// Check that worker.unref() makes the 'exit' event not be emitted, if it is
|
|
// the only thing we would otherwise be waiting for.
|
|
|
|
// Use `setInterval()` to make sure the worker is alive until the end of the
|
|
// event loop turn.
|
|
const w = new Worker('setInterval(() => {}, 100);', { eval: true });
|
|
w.unref();
|
|
w.on('exit', common.mustNotCall());
|