I want to fork a new process in the very begin of my nodejs app.js, then in main process, a http server will be created, and in new process i will run a while true
loop to do some jobs.
I have read child_process.fork(modulePath,..)
, it requires a modulePath
, in my case I only need to fork a process like fork()
in C
something like this:
// very begin of the server.js
fork(function(new_process) {
// child process
while(true) {
//do sth
}
});
// main process
// balabala
server.listen(3000, function () {
console.log('Express server listening on port 3000');
});
via Sato
No comments:
Post a Comment