diff options
author | Andreas Madsen <amwebdk@gmail.com> | 2017-11-22 20:41:00 +0300 |
---|---|---|
committer | Andreas Madsen <amwebdk@gmail.com> | 2017-12-19 20:04:52 +0300 |
commit | 3b8da4cbe8a7f36fcd8892c6676a55246ba8c3be (patch) | |
tree | 1afc84002d1716f4acd28126df214127e0262c3c /src/stream_base-inl.h | |
parent | 0784b0440c05464f79b857f7d8698fcc953d3fb3 (diff) |
async_hooks: use scope for defaultTriggerAsyncId
Previously the getter would mutate the kDefaultTriggerAsncId value. This
refactor changes the setter to bind the current kDefaultTriggerAsncId to
a scope, such that the getter doesn't have to mutate its own value.
PR-URL: https://github.com/nodejs/node/pull/17273
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/stream_base-inl.h')
-rw-r--r-- | src/stream_base-inl.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h index cc89a11bac2..cdcff67cc55 100644 --- a/src/stream_base-inl.h +++ b/src/stream_base-inl.h @@ -143,7 +143,8 @@ void StreamBase::JSMethod(const FunctionCallbackInfo<Value>& args) { if (!wrap->IsAlive()) return args.GetReturnValue().Set(UV_EINVAL); - AsyncHooks::InitScope init_scope(handle->env(), handle->get_async_id()); + AsyncHooks::DefaultTriggerAsyncIdScope trigger_scope( + handle->env(), handle->get_async_id()); args.GetReturnValue().Set((wrap->*Method)(args)); } |