Skip to content

Commit

Permalink
doc: runtime deprecate flag --trace-atomics-wait
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-ippolito committed Dec 16, 2023
1 parent fa18378 commit f0d10f8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
9 changes: 7 additions & 2 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -3313,16 +3313,21 @@ Values other than `undefined`, `null`, integer numbers, and integer strings

<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/51179
description: Runtime deprecation.
- version:
- v18.8.0
- v16.18.0
pr-url: https://github.com/nodejs/node/pull/44093
description: Documentation-only deprecation.
-->

Type: Documentation-only
Type: Runtime

The [`--trace-atomics-wait`][] flag is deprecated.
The [`--trace-atomics-wait`][] flag is deprecated because
it uses the V8 hook `SetAtomicsWaitCallback`,
that will be removed in a future V8 release.

### DEP0166: Double slashes in imports and exports targets

Expand Down
4 changes: 4 additions & 0 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ void Environment::InitializeDiagnostics() {
if (options_->trace_uncaught)
isolate_->SetCaptureStackTraceForUncaughtExceptions(true);
if (options_->trace_atomics_wait) {
ProcessEmitDeprecationWarning(
Environment::GetCurrent(isolate_),
"The flag --trace-atomics-wait is deprecated.",
"DEP0165");
isolate_->SetAtomicsWaitCallback(AtomicsWaitCallback, this);
AddCleanupHook([](void* data) {
Environment* env = static_cast<Environment*>(data);
Expand Down
14 changes: 14 additions & 0 deletions test/parallel/test-trace-atomic-deprecation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

const common = require('../common');
const assert = require('assert');
const { test } = require('node:test');

test('should emit deprecation warning DEP0165', async () => {
await common.spawnPromisified(process.execPath, ['--trace-atomics-wait', '-e', '{}'])
.then(common.mustCall(({ code, stdout, stderr }) => {
assert.strictEqual(code, 0);
assert.strictEqual(stdout, '');
assert.match(stderr, /\[DEP0165\] DeprecationWarning:/);
}));
});
2 changes: 1 addition & 1 deletion test/parallel/test-trace-atomics-wait.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if (process.argv[2] === 'child') {

const proc = child_process.spawnSync(
process.execPath,
[ '--trace-atomics-wait', __filename, 'child' ],
[ '--disable-warning=DEP0165', '--trace-atomics-wait', __filename, 'child' ],
{ encoding: 'utf8', stdio: [ 'inherit', 'inherit', 'pipe' ] });

if (proc.status !== 0) console.log(proc);
Expand Down

0 comments on commit f0d10f8

Please sign in to comment.