Browse Source

Revert "async_hooks: only set up hooks if used"

This reverts commit 410b141764.

PR-URL: https://github.com/nodejs/node/pull/13509
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
v6
Trevor Norris 8 years ago
committed by Anna Henningsen
parent
commit
b9379095e1
No known key found for this signature in database GPG Key ID: D8B9F5AEAE84E4CF
  1. 17
      lib/async_hooks.js

17
lib/async_hooks.js

@ -49,7 +49,12 @@ const before_symbol = Symbol('before');
const after_symbol = Symbol('after');
const destroy_symbol = Symbol('destroy');
let setupHooksCalled = false;
// Setup the callbacks that node::AsyncWrap will call when there are hooks to
// process. They use the same functions as the JS embedder API.
async_wrap.setupHooks({ init,
before: emitBeforeN,
after: emitAfterN,
destroy: emitDestroyN });
// Used to fatally abort the process if a callback throws.
function fatalError(e) {
@ -98,16 +103,6 @@ class AsyncHook {
if (hooks_array.includes(this))
return this;
if (!setupHooksCalled) {
setupHooksCalled = true;
// Setup the callbacks that node::AsyncWrap will call when there are
// hooks to process. They use the same functions as the JS embedder API.
async_wrap.setupHooks({ init,
before: emitBeforeN,
after: emitAfterN,
destroy: emitDestroyN });
}
// createHook() has already enforced that the callbacks are all functions,
// so here simply increment the count of whether each callbacks exists or
// not.

Loading…
Cancel
Save