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

doc: clarify sentence in event loop doc #8400

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
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
15 changes: 8 additions & 7 deletions doc/topics/the-event-loop-timers-and-nexttick.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ order of operations.
│ ┌──────────┴────────────┐ │ incoming: │
│ │ poll │<─────┤ connections, │
│ └──────────┬────────────┘ │ data, etc. │
│ ┌──────────┴────────────┐ └───────────────┘
│ ┌──────────┴────────────┐ └───────────────┘
│ │ check │
│ └──────────┬────────────┘
│ ┌──────────┴────────────┐
└──┤ close callbacks │
└───────────────────────┘
└───────────────────────┘

*note: each box will be referred to as a "phase" of the event loop.*

Expand Down Expand Up @@ -69,11 +69,12 @@ actually uses - are those above._

* **timers**: this phase executes callbacks scheduled by `setTimeout()`
and `setInterval()`.
* **I/O callbacks**: most types of callback except timers, `setImmediate()`, close
* **idle, prepare**: only used internally
* **poll**: retrieve new I/O events; node will block here when appropriate
* **check**: `setImmediate()` callbacks are invoked here
* **close callbacks**: e.g socket.on('close', ...)
* **I/O callbacks**: executes almost all callbacks with the exception of
close callbacks, the ones scheduled by timers, and `setImmediate()`.
* **idle, prepare**: only used internally.
* **poll**: retrieve new I/O events; node will block here when appropriate.
* **check**: `setImmediate()` callbacks are invoked here.
* **close callbacks**: e.g. `socket.on('close', ...)`.

Between each run of the event loop, Node.js checks if it is waiting for
any asynchronous I/O or timers and shuts down cleanly if there are not
Expand Down