2019-02-13 22:01:55 +01:00
|
|
|
'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.
|
|
|
|
|
2019-02-17 19:06:24 +01:00
|
|
|
// 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 });
|
2019-02-13 22:01:55 +01:00
|
|
|
w.unref();
|
|
|
|
w.on('exit', common.mustNotCall());
|