MCPcopy Create free account
hub / github.com/MultithreadedJSBook/code-samples / runWorker

Function runWorker

ch5-game-of-life/thread-gol.js:129–137  ·  view source on GitHub ↗
({ range, i })

Source from the content-addressed store, hash-verified

127 }
128
129 function runWorker({ range, i }) {
130 const grid = new Grid(SIZE, sharedMemory);
131 while (true) {
132 Atomics.wait(sync, i, 0);
133 grid.iterate(...range);
134 Atomics.store(sync, i, 0);
135 Atomics.notify(sync, i);
136 }
137 }
138
139 function runCoord() {
140 for (let i = 0; i < THREADS; i++) {

Callers 1

initListenerFunction · 0.85

Calls 1

iterateMethod · 0.95

Tested by

no test coverage detected