Skip to content

Commit

Permalink
src: avoid duplicate AtExit functions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ofrobots authored and Fishrock123 committed Sep 9, 2016
1 parent 13a522a commit 0f2c619
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3406,7 +3406,7 @@ void SetupProcessObject(Environment* env,
#undef READONLY_PROPERTY


static void AtExit() {
static void AtProcessExit() {
uv_tty_reset_mode();
}

Expand Down Expand Up @@ -3443,7 +3443,7 @@ void LoadEnvironment(Environment* env) {
env->isolate()->SetFatalErrorHandler(node::OnFatalError);
env->isolate()->AddMessageListener(OnMessage);

atexit(AtExit);
atexit(AtProcessExit);

TryCatch try_catch(env->isolate());

Expand Down

0 comments on commit 0f2c619

Please sign in to comment.