source: trip-planner-front/node_modules/piscina/test/fixtures/wait-for-others.ts@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 319 bytes
Line 
1import { threadId } from 'worker_threads';
2
3module.exports = async function ([i32array, n]) {
4 Atomics.add(i32array, 0, 1);
5 Atomics.notify(i32array, 0, Infinity);
6 let lastSeenValue;
7 while ((lastSeenValue = Atomics.load(i32array, 0)) < n) {
8 Atomics.wait(i32array, 0, lastSeenValue);
9 }
10 return threadId;
11};
Note: See TracBrowser for help on using the repository browser.