0.0.1 • Published 12 years ago
multi-thread.js v0.0.1
thread.js
Add Java-like multi-threading to node.js applications, without having to write a separate file.
Usage
Thread.js has one method that you pass a function to. It will then run that function on a separate thread.
var threadjs = require('thread.js');
threadjs.runTask(function () {
for (var i = 0; i < 100000, i++) {
}
console.log("Done.");
});
How Does it Work?
The runTask method converts the passed-in function into a string. And then, it will spawn a new node.js process, with the function's string as a command-line argument.
0.0.1
12 years ago