co-thread
spawn multiple co 'threads'
Last updated 11 years ago by tjholowaychuk .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install co-thread 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.0.1                                ...           latest (11 years ago)

1 Versions

  • 0.0.1                                ...           11 years ago
Maintainers (1)
Downloads
Total 2
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (5)
Dependents (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE