Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 342 Bytes

File metadata and controls

20 lines (14 loc) · 342 Bytes

TypeScript_threads_lock

An Lock object can be used to mediate access to an application's global data or to protect a critical section of code.

React Native

import Lock from '/utils/lock';

const lock = new Lock( { maxProcessing:1 } );

async function fn() {
  await lock.lock(key);

  .
  .
  .

  lock.unlock(key);
}