You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

12 lines
277 B

'use strict';
const { promisify } = require('util');
const sleep = promisify(setTimeout);
const buf = new Uint32Array(new SharedArrayBuffer(4));
module.exports = async ({ time = 100, a }) => {
await sleep(time);
const ret = Atomics.exchange(buf, 0, a);
return ret;
};