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 90c0b28
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 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: REPLACEME

Check warning on line 3317 in doc/api/deprecations.md

View workflow job for this annotation

GitHub Actions / lint-pr-url

pr-url doesn't match the URL of the current PR.
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:/);
}));
});

0 comments on commit 90c0b28

Please sign in to comment.