MCPcopy Index your code
hub / github.com/nodejs/node / popAsyncContext

Function popAsyncContext

lib/internal/async_hooks.js:562–577  ·  view source on GitHub ↗
(asyncId)

Source from the content-addressed store, hash-verified

560
561// This is the equivalent of the native pop_async_ids() call.
562function popAsyncContext(asyncId) {
563 const stackLength = async_hook_fields[kStackLength];
564 if (stackLength === 0) return false;
565
566 if (async_hook_fields[kCheck] > 0 && async_id_fields[kExecutionAsyncId] !== asyncId) {
567 // Do the same thing as the native code (i.e. crash hard).
568 return popAsyncContext_(asyncId);
569 }
570
571 const offset = stackLength - 1;
572 async_id_fields[kExecutionAsyncId] = async_wrap.async_ids_stack[2 * offset];
573 async_id_fields[kTriggerAsyncId] = async_wrap.async_ids_stack[2 * offset + 1];
574 execution_async_resources.pop();
575 async_hook_fields[kStackLength] = offset;
576 return offset > 0;
577}
578
579
580function executionAsyncId() {

Callers 4

promiseAfterHookFunction · 0.85
emitAfterScriptFunction · 0.85
processPromiseRejectionsFunction · 0.85

Calls 1

popMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…