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

Function fork

test/parallel/test-tls-ticket-cluster.js:75–90  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

73 }
74
75 function fork() {
76 const worker = cluster.fork();
77 worker.on('message', ({ msg, port }) => {
78 console.error('[primary] got %j', msg);
79 if (msg === 'reused') {
80 ++reusedCount;
81 } else if (msg === 'listening' && ++listeningCount === workerCount) {
82 workerPort = port;
83 shoot();
84 }
85 });
86
87 worker.on('exit', () => {
88 console.error('[primary] worker died');
89 });
90 }
91 for (let i = 0; i < workerCount; i++) {
92 fork();
93 }

Calls 3

shootFunction · 0.85
onMethod · 0.45
errorMethod · 0.45

Tested by 1

testFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…