mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
- Initialize `thread_exit_async_` only once the thread has been started. This is done since it is only triggered from the thread when it is exiting. - Move the final `uv_run` to the `Worker` destructor. This makes sure that it is always run, regardless of whether the thread is actually started or not. - Always dispose the `Isolate` before cleaning up the libuv event loop. This now matches the reverse order of initialization. Fixes: https://github.com/nodejs/node/issues/22736 PR-URL: https://github.com/nodejs/node/pull/22773 Reviewed-By: James M Snell <jasnell@gmail.com>
16 lines
412 B
JavaScript
16 lines
412 B
JavaScript
// Flags: --experimental-worker
|
|
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const { Worker } = require('worker_threads');
|
|
|
|
// This tests verifies that failing to serialize workerData does not keep
|
|
// the process alive.
|
|
// Refs: https://github.com/nodejs/node/issues/22736
|
|
|
|
assert.throws(() => {
|
|
new Worker('./worker.js', {
|
|
workerData: { fn: () => {} }
|
|
});
|
|
}, /DataCloneError/);
|