blob: adf6bbf14563cd3533bd0e2d5185146ef8ae960a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
'use strict';
const common = require('../common');
const { once } = require('events');
const { Worker } = require('worker_threads');
// Test that calling worker.terminate() on an unref()’ed Worker instance
// still resolves the returned Promise.
async function test() {
const worker = new Worker('setTimeout(() => {}, 1000000);', { eval: true });
await once(worker, 'online');
worker.unref();
await worker.terminate();
}
test().then(common.mustCall());
|