简体   繁体   中英

How can I kill the parent process from a child thread spawned by cluster.fork?

An error gets thrown in a child thread created by cluster.fork() and I want to kill the parent (and in doing so, kill all other sibling threads.

How can I do this from within the child thread ( cluster.isWorker === true : true )?

I think I figured it out. From within a worker, I can't seem to access process globally, but this seems to work:

cluster.worker.process.kill(cluster.worker.process.ppid)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM