multi-thread.js
v0.0.1
Published
A tool to call functions on a separate thread.
Downloads
1
Readme
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.