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

Why UV_RUN_ONCE and not UV_RUN_NOWAIT? #2466

Closed
tolmasky opened this issue Aug 20, 2015 · 4 comments
Closed

Why UV_RUN_ONCE and not UV_RUN_NOWAIT? #2466

tolmasky opened this issue Aug 20, 2015 · 4 comments
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. libuv Issues and PRs related to the libuv dependency or the uv binding. question Issues that look for answers.

Comments

@tolmasky
Copy link
Contributor

In node.cc immediately after LoadEnvironment() in Start()it jumps to:

more = uv_run(env->event_loop(), UV_RUN_ONCE);

I understand why it's UV_RUN_ONCE on each iteration of the loop, not why it starts that way. I imagine there are some default events that happen no matter what the first time through, could someone enlighten me as to what those are (that stop node from just blocking forever)?

@Fishrock123 Fishrock123 added question Issues that look for answers. c++ Issues and PRs that require attention from people who are familiar with C++. libuv Issues and PRs related to the libuv dependency or the uv binding. labels Aug 20, 2015
@sam-github
Copy link
Contributor

there are a number of calls to process.nextTick in src/node.js, is that what you are looking for?

@tolmasky
Copy link
Contributor Author

Possibly -- I guess I'm confused why process._getActiveHandles() returns an empty array right before it enters this initial uv_run (causing me to believe that uv_run would block forever). Do ticks not count as handles in this sense?

@bnoordhuis
Copy link
Member

They're backed by a uv_idle_t handle that is not visible to JS land. Grep src/node.cc for immediate_idle_handle.

@Fishrock123
Copy link
Contributor

Closing, @tolmasky let us know if you have more questions. :)

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++. libuv Issues and PRs related to the libuv dependency or the uv binding. question Issues that look for answers.
Projects
None yet
Development

No branches or pull requests

4 participants