MCPcopy Index your code
hub / github.com/nodejs/node / spawnWorker

Function spawnWorker

benchmark/misc/startup-core.js:43–60  ·  view source on GitHub ↗
(script, bench, state)

Source from the content-addressed store, hash-verified

41}
42
43function spawnWorker(script, bench, state) {
44 const child = new Worker(script);
45 child.on('exit', (code) => {
46 if (code !== 0) {
47 throw new Error(`Worker stopped with exit code ${code}`);
48 }
49 state.finished++;
50 if (state.finished === 0) {
51 // Finished warmup.
52 bench.start();
53 }
54 if (state.finished < state.n) {
55 spawnWorker(script, bench, state);
56 } else {
57 bench.end(state.n);
58 }
59 });
60}
61
62function main({ n, script, mode }) {
63 script = path.resolve(__dirname, '../../', `${script}`);

Callers 1

mainFunction · 0.70

Calls 3

onMethod · 0.45
startMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…