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

Function runCoord

ch5-game-of-life/thread-gol.js:139–156  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

137 }
138
139 function runCoord() {
140 for (let i = 0; i < THREADS; i++) {
141 Atomics.store(sync, i, 1);
142 Atomics.notify(sync, i);
143 }
144 for (let i = 0; i < THREADS; i++) {
145 Atomics.wait(sync, i, 1);
146 }
147 const oldCells = cells;
148 cells = nextCells;
149 nextCells = oldCells;
150 for (let x = 0; x < SIZE; x++) {
151 for (let y = 0; y < SIZE; y++) {
152 sharedImageBuf[SIZE * x + y] = cells[SIZE * x + y] ? BLACK : WHITE;
153 }
154 }
155 self.postMessage({});
156 }
157}

Callers 1

initListenerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected