Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

danbev
Copy link
Contributor

@danbev danbev commented Mar 16, 2018

This commit introduces a copyHooks function that can be used by
storeActiveHooks and restoreActiveHooks to remove some code duplication.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the async_hooks Issues and PRs related to the async hooks subsystem. label Mar 16, 2018
@danbev
Copy link
Contributor Author

danbev commented Mar 16, 2018

setHooks(active_hooks.tmp_fields, async_hook_fields);
}

function setHooks(from, to) {
Copy link
Member

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.

Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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).

setHooks(active_hooks.tmp_fields, async_hook_fields);
}

function setHooks(from, to) {
Copy link
Member

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?

Copy link
Member

@apapirovski apapirovski left a 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.
@danbev danbev force-pushed the async_hooks_set_hooks branch from 2045c5e to 657a33d Compare March 18, 2018 10:50
@danbev danbev changed the title async_hooks: add setHooks function async_hooks: add copyHooks function Mar 18, 2018
@danbev
Copy link
Contributor Author

danbev commented Mar 18, 2018

Rebased and updated CI: https://ci.nodejs.org/job/node-test-pull-request/13726/

@danbev
Copy link
Contributor Author

danbev commented Mar 18, 2018

node-test-commit failure looks unrelated

console output:

06: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 

@danbev
Copy link
Contributor Author

danbev commented Mar 20, 2018

Landed in 5a4a1cb.

@danbev danbev closed this Mar 20, 2018
@danbev danbev deleted the async_hooks_set_hooks branch March 20, 2018 06:48
danbev added a commit that referenced this pull request Mar 20, 2018
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]>
MylesBorins pushed a commit that referenced this pull request Mar 20, 2018
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]>
MylesBorins pushed a commit that referenced this pull request Mar 20, 2018
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]>
@targos targos mentioned this pull request Mar 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
async_hooks Issues and PRs related to the async hooks subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants