Comparing version 0.2.1 to 0.2.2
{ | ||
"name": "bobbin", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "easily spool up thread-like worker processes", | ||
@@ -33,2 +33,5 @@ "main": "index.js", | ||
"homepage": "https://github.com/bchociej/bobbin", | ||
"engines": { | ||
"node": ">=0.8.0" | ||
}, | ||
"dependencies": { | ||
@@ -35,0 +38,0 @@ "coffee-script": "^1.8.0", |
@@ -10,6 +10,6 @@ # bobbin | ||
var bobbin = require('bobbin'); | ||
var pool = bobbin.create(4); // 4 processes; defaults to os.cpus().length | ||
var pool = bobbin.create(4); // create 4 processes; defaults to os.cpus().length | ||
// to send some work, in this case concatenate two strings: | ||
// to send some work (in this case concatenate two strings `left' and `right'): | ||
@@ -36,4 +36,6 @@ var left = 'foo', right = 'bar'; | ||
1. calls to `pool.run()` are dispatched to workers in a round-robin fashion | ||
1. calls to `pool.run()` are dispatched to workers in a round-robin fashion, though idle workers are prioritized. | ||
2. you can't send closures to workers, so explicitly send data in the first arguments to `pool.run()`. those arguments will be passed verbatim into your work function. | ||
3. your local callback gets called with whatever your work function calls back with. | ||
4. to `create()` a pool, you have to be the `cluster` master, i.e. `cluster.isMaster` | ||
23011
11
40