Last change
on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
319 bytes
|
Line | |
---|
1 | import { threadId } from 'worker_threads';
|
---|
2 |
|
---|
3 | module.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.