会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
never put off till tomorrow what you can do today
The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.
博客园
首页
新随笔
联系
订阅
管理
2016年10月18日
通过两段代码理解阻塞IO和非阻塞IO
摘要: 首先大家来看一段PHP的代码 同样的代码我们在Node.js中如何实现? 上述两端代码不仅仅是语义上的区别,我们可以发现Node.js使用了回调函数。两者最主要的区别就体现在阻塞和非阻塞上。 第一个案例中PHP的代码,sleep(5);阻塞了线程的执行,换句话说当程序进入睡眠的时候就什么都不会做了。
阅读全文
posted @ 2016-10-18 10:15 jack.li
阅读(1374)
评论(0)
推荐(0)
编辑