-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
async_hooks: add copyHooks function #19391
Conversation
lib/internal/async_hooks.js
Outdated
setHooks(active_hooks.tmp_fields, async_hook_fields); | ||
} | ||
|
||
function setHooks(from, to) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I like these kinds of abstractions, but for sure it seems that from
and to
should be switched.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe call it copyHooks
? Maybe it’s just my C background that sees parallels to memcpy()
& co here, but it seems closer to what’s happening than setHooks
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like copyHooks
, I'll update the PR. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AndreasMadsen I'll also changed the parameters, so it will be copyHooks(destination, source)
.
lib/internal/async_hooks.js
Outdated
setHooks(active_hooks.tmp_fields, async_hook_fields); | ||
} | ||
|
||
function setHooks(from, to) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe call it copyHooks
? Maybe it’s just my C background that sees parallels to memcpy()
& co here, but it seems closer to what’s happening than setHooks
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on naming it copyHooks
This commit introduces a copyHooks function that can be used by storeActiveHooks and restoreActiveHooks to remove some code duplication.
2045c5e
to
657a33d
Compare
Rebased and updated CI: https://ci.nodejs.org/job/node-test-pull-request/13726/ |
node-test-commit failure looks unrelated06:55:35 Building addon /home/iojs/build/workspace/node-test-commit-linux/nodes/debian8-64/test/addons-napi/test_array/
06:55:35 gyp info it worked if it ends with ok
06:55:35 gyp info using [email protected]
06:55:35 gyp info using [email protected] | linux | x64
06:55:35 gyp info chdir /home/iojs/build/workspace/node-test-commit-linux/nodes/debian8-64/test/addons-napi/test_array/
06:55:35 Aborted (core dumped)
06:55:35 Makefile:369: recipe for target 'test/addons-napi/.buildstamp' failed
06:55:35 make[1]: *** [test/addons-napi/.buildstamp] Error 1
06:55:35 make[1]: *** Waiting for unfinished jobs....
06:55:49 |
Landed in 5a4a1cb. |
This commit introduces a copyHooks function that can be used by storeActiveHooks and restoreActiveHooks to remove some code duplication. PR-URL: #19391 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]>
This commit introduces a copyHooks function that can be used by storeActiveHooks and restoreActiveHooks to remove some code duplication. PR-URL: #19391 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]>
This commit introduces a copyHooks function that can be used by storeActiveHooks and restoreActiveHooks to remove some code duplication. PR-URL: #19391 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]>
This commit introduces a copyHooks function that can be used by
storeActiveHooks and restoreActiveHooks to remove some code duplication.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes