bossiernesto / nodejs_event_loop_examples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The Node.js Event Loop, Timers, and process.nextTick()

Event Loop phases

Phases Overview

  • timers: this phase executes callbacks scheduled by setTimeout() and setInterval().
  • pending callbacks: executes I/O callbacks deferred to the next loop iteration.
  • idle, prepare: only used internally.
  • poll: retrieve new I/O events; execute I/O related callbacks (almost all with the exception of close callbacks, the ones scheduled by timers, and setImmediate()); node will block here when appropriate.
  • check: setImmediate() callbacks are invoked here.
  • close callbacks: some close callbacks, e.g. socket.on('close', ...).

Links

About

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:JavaScript 100.0%