Offload functions to worker threads with shared memory primitives for Node.js.
8
fork

Configure Feed

Select the types of activity you want to include in your feed.

test(shared): exercise dispose behaviorally in RwLock.tryReadLock test

+4 -5
+4 -5
test/shared/rwlock.test.ts
··· 119 119 assert.deepEqual(results.sort(), ['r1', 'r2']); 120 120 }); 121 121 122 - it('tryReadLock returns a guard when unlocked', () => { 122 + it('tryReadLock returns a guard when unlocked', async () => { 123 123 const rw = rwlock(); 124 124 const guard = rw.tryReadLock(); 125 125 assert.ok(guard); 126 126 assert.equal(typeof guard[Symbol.dispose], 'function'); 127 127 guard[Symbol.dispose](); 128 - // Should be able to read-lock again after dispose 129 - const guard2 = rw.tryReadLock(); 130 - assert.ok(guard2); 131 - rw.readUnlock(); 128 + // writeLock only succeeds if readUnlock was called (reader count back to 0) 129 + await rw.writeLock(); 130 + rw.writeUnlock(); 132 131 }); 133 132 134 133 it('multiple concurrent tryReadLock calls all succeed', () => {