Node module to simulate processes.
Usage:
var iproc=require("iproc");
var proc=iproc();
// create a process - pid returned
var pid=proc.create({
exec:function(){
/*code here*/
self.onmessage=function(ev){
// ev.data = message
postMessage("/*message back to main process*/");
};
},
autostart:(true|false),
name:"process name",
onmessage:function(ev){/*ev.data is the message*/}
});
// start a process via pid
proc.start(pid);
// stop an active process via pid
proc.stop(pid);
// stop and kill a process via pid
proc.destroy(pid);
// send message to process
proc.message(pid,message);
// get info on a pid
proc.info(pid);
// list active processes pids
proc.list();
Since last publish, I have completely reworked the system, not it only takes a function, (it can take a filepath if needed)