MCPcopy Create free account
hub / github.com/nodejs/node-addon-api / checkAcquire

Function checkAcquire

test/threadsafe_function/threadsafe_function_sum.js:44–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42 }
43
44 async function checkAcquire () {
45 const calls = [];
46 const { promise, createThread, stopThreads } = binding.threadsafe_function_sum.testAcquire(Array.prototype.push.bind(calls));
47 for (let i = 0; i < THREAD_COUNT; i++) {
48 createThread();
49 }
50 stopThreads();
51 const result = await promise;
52 assert.ok(result);
53 assert.equal(sum(calls), EXPECTED_SUM);
54 }
55
56 return check(binding.threadsafe_function_sum.testDelayedTSFN)
57 .then(() => check(binding.threadsafe_function_sum.testWithTSFN))

Callers 1

testFunction · 0.70

Calls 1

sumFunction · 0.70

Tested by 1

testFunction · 0.56