mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
Other threads can still hold a valid handle to the tsfn after finalization if finalization was triggered by - release with napi_tsfn_abort, or - environment shutdown Handle this by: - protecting finalization itself with the mutex - if necessary, delay deletion after finalization to when thread_count drops to 0 - releasing all resources as soon as possible before deletion Fixes: https://github.com/nodejs/node/issues/55706 PR-URL: https://github.com/nodejs/node/pull/55877 Co-Authored-By: Gabriel Schulhof <gabrielschulhof@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
18 lines
454 B
JavaScript
18 lines
454 B
JavaScript
'use strict';
|
|
|
|
const common = require('../../common');
|
|
const process = require('process');
|
|
const assert = require('assert');
|
|
const { fork } = require('child_process');
|
|
const binding = require(`./build/${common.buildType}/binding`);
|
|
|
|
if (process.argv[2] === 'child') {
|
|
binding();
|
|
setTimeout(() => {}, 100);
|
|
} else {
|
|
const child = fork(__filename, ['child']);
|
|
child.on('close', common.mustCall((code) => {
|
|
assert.strictEqual(code, 0);
|
|
}));
|
|
}
|