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

Function defaultTriggerAsyncIdScope

lib/internal/async_hooks.js:464–477  ·  view source on GitHub ↗

* Sets a default top level trigger ID to be used * @template {Array } T * @template {unknown} R * @param {number} triggerAsyncId * @param { (...T: args) => R } block * @param {T} args * @returns {R}

(triggerAsyncId, block, ...args)

Source from the content-addressed store, hash-verified

462 * @returns {R}
463 */
464function defaultTriggerAsyncIdScope(triggerAsyncId, block, ...args) {
465 if (triggerAsyncId === undefined)
466 return ReflectApply(block, null, args);
467 // CHECK(NumberIsSafeInteger(triggerAsyncId))
468 // CHECK(triggerAsyncId > 0)
469 const oldDefaultTriggerAsyncId = async_id_fields[kDefaultTriggerAsyncId];
470 async_id_fields[kDefaultTriggerAsyncId] = triggerAsyncId;
471
472 try {
473 return ReflectApply(block, null, args);
474 } finally {
475 async_id_fields[kDefaultTriggerAsyncId] = oldDefaultTriggerAsyncId;
476 }
477}
478
479function hasHooks(key) {
480 return async_hook_fields[key] > 0;

Callers 13

responseKeepAliveFunction · 0.85
writeAfterFINFunction · 0.85
net.jsFile · 0.85
lookupAndConnectFunction · 0.85
lookupAndConnectMultipleFunction · 0.85
setupListenHandleFunction · 0.85
endFunction · 0.85
onErrorFunction · 0.85
afterDnsFunction · 0.85
dgram.jsFile · 0.85
connectionListenerFunction · 0.85
processRespondWithFDFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…