60

node,setImmeidate, setTimeout, nextTick你真的了解么? | hello2dj

 6 years ago
source link: https://hello2dj.github.io/2018/01/10/node%E5%AE%9A%E6%97%B6%E5%99%A8%E7%9B%B8%E5%85%B3%E8%AF%A6%E8%A7%A3/?
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
先来温习一下event loop中的几个phase可参见我的上篇文章libuv概览 timers: 这个phase是来检查定时器是否到期的,并执行的 poll(I/O): 这个是用来监听fd的事件的,比如socket的可读,可写,文件的可读可等 check: 当事件循环被I/O阻塞结束之后立刻调用check handle的回调。本质上他是和prepare phase(在循环被I/O阻塞之前(ri

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK