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

Improve TickEventLoop() #46

Merged
merged 3 commits into from
Jan 30, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4803,18 +4803,20 @@ inline static bool TickEventLoop(Environment & env) {
bool more = false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more is not used anymore, right?

uv_run(env.event_loop(), UV_RUN_NOWAIT);

if (uv_loop_alive(env.event_loop())) {
return true;
}

v8_platform.DrainVMTasks();

more = uv_loop_alive(env.event_loop());
if (more)
return more;
if (uv_loop_alive(env.event_loop()))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should either add curly braces around the return statement here or remove them in line 4806 to be consistent.

return true;

EmitBeforeExit(&env);

// Emit `beforeExit` if the loop became alive either after emitting
// event, or after running some callbacks.
more = uv_loop_alive(env.event_loop());
return more;
return uv_loop_alive(env.event_loop());
}

// This is where the magic happens. Creates JavaScript context and a JS Environment, then runs the uv event loop until it is no longer alive (see TickEventLoop()), then tears down Env and context and returns JS exit code.
Expand Down