Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

event-loop

Callback execution order

On each iteration of the event loop callbacks are run in the following order:

alt text

  1. Run initial script
  • -> Run Next Tick callbacks.
  1. Run Timer callbacks: All active timers scheduled for a time before the loop’s concept of now get their callbacks called.
  • -> Run Next Tick callbacks.
  1. Run Pending I/O callbacks: If the previous iteration deferred any I/O callback it will be run at this point.
  • -> Run Next Tick callbacks.
  1. Run Current I/O callbacks: At this point the loop will block for I/O (with a previously calculated timeout), all I/O related handles that were monitoring a given file descriptor for a read or write operation get their callbacks called at this point.
  • -> Run Next Tick callbacks.
  1. Run Immediate callbacks: The entire callback queue is processed every event loop iteration.
  • -> Run Next Tick callbacks.
  1. Go to step 2: Start new cycle

About

nodejs event-loop

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages