source: trip-planner-front/node_modules/piscina/test/fixtures/sleep.js@ 8d391a1

Last change on this file since 8d391a1 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
3const { promisify } = require('util');
4const sleep = promisify(setTimeout);
5
6const buf = new Uint32Array(new SharedArrayBuffer(4));
7
8module.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.