diveintonode_examples icon indicating copy to clipboard operation
diveintonode_examples copied to clipboard

《深入浅出Node.js》的相关代码

Results 15 diveintonode_examples issues
Sort by recently updated
recently updated
newest added

```js for (var i = 0; i < cpus.length; i++) { createWorker(); } server.close(); ``` ```js var server = http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('handled by child, pid...

题目中 **自身代码** 指的是,创建主循环,从观察者中取请求对象等操作。 按我的理解,不可能在IO线程池中,是在js主线程还是node的其他线程? 另外,callback肯定在js主线程上执行,那么时间循环应该不包括callback的执行吧。 请教了。

![image](https://cloud.githubusercontent.com/assets/13595509/22675205/4a84c2ba-ed1f-11e6-9167-fc85b1c4f886.png)

看了您的文章,想请教一个问题。 是事件循环每次都自己去获取执行结束的I/O请求对象加入到队列尾部,还是负责I/O操作的线程在完成I/O操作后,自己将I/O请求对象添加到队列尾部? 如果是前者,那么这是否符合观察者模式?

var fs = require('fs'); var Deferred = require('./sequence.js').Deferred; var smooth = function (method) { return function () { var deferred = new Deferred(); var args = Array.prototype.slice.call(arguments, 1);//这里参数为1下面会报路径错误 为0才会传路径参数进去 args.push(deferred.callback());...