Created
February 28, 2014 17:06
-
-
Save rudyjahchan/9275029 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cluster = require 'cluster' | |
numCPUs = require('os').cpus().length | |
exports = module.exports = launch: -> | |
console.log 'Before the fork' | |
if (cluster.isMaster) | |
console.log 'I am the master, launching workers!' | |
cluster.fork() for i in [0...numCPUs] | |
else | |
console.log 'I am a worker!' | |
console.log 'After the fork' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment