Skip to content

Commit

Permalink
Support for nodejs v14.x proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
laverdet committed Apr 17, 2020
1 parent 4b9fcc9 commit 7de7f30
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions fibers.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ function setupAsyncHacks(Fiber) {
throw new Error('Couldn\'t figure out how to get async stack size');
}

if (!aw.popAsyncIds || !aw.pushAsyncIds) {
var popAsyncContext = aw.popAsyncContext || aw.popAsyncIds;
var pushAsyncContext = aw.pushAsyncContext || aw.pushAsyncIds;
if (!popAsyncContext || !pushAsyncContext) {
throw new Error('Push/pop do not exist');
}

Expand Down Expand Up @@ -72,14 +74,14 @@ function setupAsyncHacks(Fiber) {
asyncId: asyncId,
triggerId: asyncIds[kTriggerAsyncId],
};
aw.popAsyncIds(asyncId);
popAsyncContext(asyncId);
}
return stack;
}

function restoreStack(stack) {
for (var ii = 0; ii < stack.length; ++ii) {
aw.pushAsyncIds(stack[ii].asyncId, stack[ii].triggerId);
pushAsyncContext(stack[ii].asyncId, stack[ii].triggerId);
}
}

Expand Down

0 comments on commit 7de7f30

Please sign in to comment.