Skip to content

Commit

Permalink
doc: runtime deprecate flag --trace-atomics-wait
Browse files Browse the repository at this point in the history
PR-URL: #51179
Refs: #42982
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
marco-ippolito authored and jasnell committed Dec 22, 2023
1 parent 1523650 commit b9df88a
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('node:assert');
const { test } = require('node:test');

test('should emit deprecation warning DEP0165', async () => {
const { code, stdout, stderr } = await common.spawnPromisified(
process.execPath, ['--trace-atomics-wait', '-e', '{}']
);
assert.match(stderr, /\[DEP0165\] DeprecationWarning:/);
assert.strictEqual(stdout, '');
assert.strictEqual(code, 0);
});
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 b9df88a

Please sign in to comment.