process in a cluster. A process `isMaster` if `process.env.NODE_WORKER_ID`
is undefined.
-### cluster.eachWorker(cb)
-
-Synchronously iterates over all of the workers.
-
- cluster.eachWorker(function(worker) {
- console.log("worker pid=" + worker.pid);
- });
-
-### cluster.workerCount()
-
-Returns the number of workers.
-
### Event: 'death'
When any of the workers die the cluster module will emit the 'death' event.
}
-cluster.eachWorker = function(cb) {
+function eachWorker(cb) {
// This can only be called from the master.
assert(cluster.isMaster);
};
-cluster.workerCount = function() {
- var c = 0;
- cluster.eachWorker(function() {
- c++;
- });
- return c;
-};
-
-
cluster.fork = function() {
// This can only be called from the master.
assert(cluster.isMaster);