multithreading - How to create threads in nodejs -
is there way create threads running multiple methods @ time. if method fails in between other threads should killed.
in advance
every node.js process single threaded design. therefore multiple threads, have have multiple processes (as other posters have pointed out, there libraries can link give ability work threads in node, no such capability exists without libraries. see answer shawn vincent referencing https://github.com/audreyt/node-webworker-threads)
you can start child processes main process shown here in node.js documentation: http://nodejs.org/api/child_process.html. examples pretty on page , pretty straight forward.
your parent process can watch close event on process started , force close other processes started achieve type of 1 fail stop strategy talking about.
also see: node.js on multi-core machines
Comments
Post a Comment