• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3const { Worker } = require('worker_threads');
4
5// Check that worker.unref() makes the 'exit' event not be emitted, if it is
6// the only thing we would otherwise be waiting for.
7
8// Use `setInterval()` to make sure the worker is alive until the end of the
9// event loop turn.
10const w = new Worker('setInterval(() => {}, 100);', { eval: true });
11w.unref();
12w.on('exit', common.mustNotCall());
13