Skip to content

Commit

Permalink
src: flip Atomics.notify alias
Browse files Browse the repository at this point in the history
PR-URL: #22844
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Kyle Farnung <kfarnung@microsoft.com>
  • Loading branch information
devsnek committed Sep 18, 2018
1 parent 8d7aa21 commit a7b59d6
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions lib/internal/per_context.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,18 @@

// https://github.com/nodejs/node/issues/21219
// Adds Atomics.notify and warns on first usage of Atomics.wake
// https://github.com/v8/v8/commit/c79206b363 adds Atomics.notify so
// now we alias Atomics.wake to notify so that we can remove it
// semver major without worrying about V8.

const AtomicsWake = global.Atomics.wake;
const AtomicsNotify = global.Atomics.notify;
const ReflectApply = global.Reflect.apply;

// wrap for function.name
function notify(...args) {
return ReflectApply(AtomicsWake, this, args);
}

const warning = 'Atomics.wake will be removed in a future version, ' +
'use Atomics.notify instead.';

let wakeWarned = false;
function wake(...args) {
function wake(typedArray, index, count) {
if (!wakeWarned) {
wakeWarned = true;

Expand All @@ -32,16 +30,10 @@
}
}

return ReflectApply(AtomicsWake, this, args);
return ReflectApply(AtomicsNotify, this, arguments);
}

global.Object.defineProperties(global.Atomics, {
notify: {
value: notify,
writable: true,
enumerable: false,
configurable: true,
},
wake: {
value: wake,
writable: true,
Expand Down

0 comments on commit a7b59d6

Please sign in to comment.