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

Function spinWorker

test/parallel/test-worker-http2-stream-terminate.js:21–32  ·  view source on GitHub ↗
(iter)

Source from the content-addressed store, hash-verified

19 process.env.HAS_STARTED_WORKER = 1;
20
21 function spinWorker(iter) {
22 const w = new Worker(__filename);
23 w.on('message', common.mustCall((msg) => {
24 assert.strictEqual(msg, 'terminate');
25 w.terminate();
26 }));
27
28 w.on('exit', common.mustCall(() => {
29 if (iter < MAX_ITERATIONS)
30 spinWorker(++iter);
31 }));
32 }
33
34 for (let i = 0; i < MAX_THREADS; i++) {
35 spinWorker(0);

Calls 2

terminateMethod · 0.95
onMethod · 0.45

Tested by

no test coverage detected