NET-Web-API-w-Angular/my-app/node_modules/piscina/test/fixtures/sleep.js

13 lines
277 B
JavaScript
Raw Normal View History

2024-02-09 00:38:41 +00:00
'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;
};