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:
277 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | const { promisify } = require('util');
|
---|
4 | const sleep = promisify(setTimeout);
|
---|
5 |
|
---|
6 | const buf = new Uint32Array(new SharedArrayBuffer(4));
|
---|
7 |
|
---|
8 | module.exports = async ({ time = 100, a }) => {
|
---|
9 | await sleep(time);
|
---|
10 | const ret = Atomics.exchange(buf, 0, a);
|
---|
11 | return ret;
|
---|
12 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.