zouyong 57b51c387e 1 il y a 5 ans
..
test 57b51c387e 1 il y a 5 ans
.npmignore 57b51c387e 1 il y a 5 ans
Makefile 57b51c387e 1 il y a 5 ans
Readme.md 57b51c387e 1 il y a 5 ans
example.js 57b51c387e 1 il y a 5 ans
index.js 57b51c387e 1 il y a 5 ans
package.json 57b51c387e 1 il y a 5 ans

Readme.md

co-thread

Run a generator function in parallel N times.

Installation

$ npm install co-thread

Example

Send a request in batches of 20 parallel GETs:

var thread = require('co-thread');
var get = require('co-request');
var co = require('co');

co(function *(){
  var times = 10;

  while (times--) {
    yield thread(function *(){
      var res = yield get('http://google.com');
      console.log(res.statusCode);
    }, 20);
  }

})();

License

MIT