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

src: avoid duplicate AtExit functions #8273

Merged
merged 1 commit into from
Aug 31, 2016

Conversation

ofrobots
Copy link
Contributor

@ofrobots ofrobots commented Aug 25, 2016

Checklist
  • make -j4 test (UNIX), or vcbuild test nosign (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

src

Description of change

node.cc had two functions with the name AtExit with entirely different
purposes:

  • node::AtExit(): file static; used to register the atexit(3) handler
    for the Node process.
  • node::AtExit(void (*)(void*), void*): publicly exported symbol that
    addons can use to request callbacks upon exit.

For code readability it is better to avoid the unintentional overload.

R=@addaleax, @bnoordhuis
EDIT: CI: https://ci.nodejs.org/job/node-test-pull-request/3835/

@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Aug 25, 2016
@addaleax
Copy link
Member

LGTM

@addaleax addaleax added the lib / src Issues and PRs related to general changes in the lib or src directory. label Aug 25, 2016
@addaleax
Copy link
Member

Btw, everytime I’m doing something inside node.cc I feel like I’m constantly jumping around between different parts of the file, so I’d also be fine with turning functions like these into C++ lambdas to make the code more “visually” local?

@ofrobots
Copy link
Contributor Author

@addaleax +1. However, atleast on my mac, the compiler doesn't like the function passed to atexit to be a lambda. I didn't try too hard though.

@addaleax
Copy link
Member

Yeah, it’s not that important anyway, was just a thought that occurred to me.

@jasnell
Copy link
Member

jasnell commented Aug 25, 2016

+1 LGTM if CI is green!

@cjihrig
Copy link
Contributor

cjihrig commented Aug 26, 2016

LGTM

@bnoordhuis
Copy link
Member

LGTM, one less minor irritant.

@jasnell
Copy link
Member

jasnell commented Aug 30, 2016

CI was a bit too red: https://ci.nodejs.org/job/node-test-pull-request/3895/

node.cc had two functions with the name AtExit with entirely different
purposes:

* node::AtExit(): file static; used to register the atexit(3) handler
  for the Node process.
* node::AtExit(void (*)(void*), void*): publicly exported symbol that
  addons can use to request callbacks upon exit.

For code readability it is better to avoid the unintentional overload.

PR-URL: nodejs#8273
Reviewed-By: addaleax - Anna Henningsen <anna@addaleax.net>
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
@ofrobots ofrobots merged commit becbcc7 into nodejs:master Aug 31, 2016
@ofrobots
Copy link
Contributor Author

Thanks, the new CI was good, landed as becbcc7.

@ofrobots ofrobots deleted the duplicate-AtExit branch August 31, 2016 16:37
@Fishrock123 Fishrock123 mentioned this pull request Sep 6, 2016
Fishrock123 pushed a commit to Fishrock123/node that referenced this pull request Sep 8, 2016
node.cc had two functions with the name AtExit with entirely different
purposes:

* node::AtExit(): file static; used to register the atexit(3) handler
  for the Node process.
* node::AtExit(void (*)(void*), void*): publicly exported symbol that
  addons can use to request callbacks upon exit.

For code readability it is better to avoid the unintentional overload.

PR-URL: nodejs#8273
Reviewed-By: addaleax - Anna Henningsen <anna@addaleax.net>
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Fishrock123 pushed a commit that referenced this pull request Sep 9, 2016
node.cc had two functions with the name AtExit with entirely different
purposes:

* node::AtExit(): file static; used to register the atexit(3) handler
  for the Node process.
* node::AtExit(void (*)(void*), void*): publicly exported symbol that
  addons can use to request callbacks upon exit.

For code readability it is better to avoid the unintentional overload.

PR-URL: #8273
Reviewed-By: addaleax - Anna Henningsen <anna@addaleax.net>
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
@MylesBorins
Copy link
Contributor

@ofrobots should this be backported? If so would you be able to submit a manual backport?

@ofrobots
Copy link
Contributor Author

No strong reason to backport this, specially if requires manual work :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants