blob: 3e696f369e4179dc9335d549b5a27419998ac83e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
'use strict';
const common = require('../common');
const { Worker } = require('worker_threads');
// This used to crash because the `.unref()` was unexpected while the Worker
// was exiting.
const w = new Worker(`
require('worker_threads').parentPort.postMessage({});
`, { eval: true });
w.on('message', common.mustCall(() => {
w.unref();
}));
// Wait a bit so that the 'message' event is emitted while the Worker exits.
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 100);
|