Mutex, the mutex implementation for async operations
5.15.0
const mut = new Mutex()
async call_api(payload: any) {
const release = await mut.acquire()
try {
// ...
// this block, will be executed exclusively
} finally {
release() // release the mutex
}
}
Mutex, the mutex implementation for async operations