MCPcopy Create free account
hub / github.com/andywer/threads.js / terminateWorkersAndMaster

Function terminateWorkersAndMaster

src/master/implementation.node.ts:142–149  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

140 }
141
142 const terminateWorkersAndMaster = () => {
143 // we should terminate all workers and then gracefully shutdown self process
144 Promise.all(allWorkers.map(worker => worker.terminate())).then(
145 () => process.exit(0),
146 () => process.exit(1),
147 )
148 allWorkers = []
149 }
150
151 // Take care to not leave orphaned processes behind. See #147.
152 process.on("SIGINT", () => terminateWorkersAndMaster())

Callers 2

initWorkerThreadsWorkerFunction · 0.85
initTinyWorkerFunction · 0.85

Calls 2

thenMethod · 0.80
terminateMethod · 0.65

Tested by

no test coverage detected