All Projects → ide → await-lock

ide / await-lock

Licence: MIT license
Mutex locks for async functions

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to await-lock

mux-stream
(De)multiplex asynchronous streams
Stars: ✭ 34 (-48.48%)
Mutual labels:  concurrency, async-await
async-oneshot
A fast, small, full-featured, no-std compatible oneshot channel
Stars: ✭ 55 (-16.67%)
Mutual labels:  concurrency, async-await
async-enumerable-dotnet
Experimental operators for C# 8 IAsyncEnumerables
Stars: ✭ 32 (-51.52%)
Mutual labels:  concurrency, async-await
Shift
Light-weight EventKit wrapper.
Stars: ✭ 31 (-53.03%)
Mutual labels:  concurrency, async-await
P Map
Map over promises concurrently
Stars: ✭ 639 (+868.18%)
Mutual labels:  concurrency, async-await
awaitchannel
Go-style concurrency and channels with Python 3.5 and asyncio
Stars: ✭ 21 (-68.18%)
Mutual labels:  concurrency, async-await
swoole-futures
⏳ Futures, Streams & Async/Await for PHP's Swoole asynchronous run-time.
Stars: ✭ 100 (+51.52%)
Mutual labels:  concurrency, async-await
Ea Async
EA Async implements async-await methods in the JVM.
Stars: ✭ 1,085 (+1543.94%)
Mutual labels:  concurrency, async-await
Concurrencpp
Modern concurrency for C++. Tasks, executors, timers and C++20 coroutines to rule them all
Stars: ✭ 340 (+415.15%)
Mutual labels:  concurrency, async-await
Promise Fun
Promise packages, patterns, chat, and tutorials
Stars: ✭ 3,779 (+5625.76%)
Mutual labels:  concurrency, async-await
Asyncio
asyncio historical repository
Stars: ✭ 952 (+1342.42%)
Mutual labels:  concurrency, async-await
conquerant
lightweight async/await for Clojure
Stars: ✭ 31 (-53.03%)
Mutual labels:  concurrency, async-await
Mvvm
MVVM helpers, including calculated properties and asynchronous notification tasks.
Stars: ✭ 129 (+95.45%)
Mutual labels:  async-await
retryx
Promise-based retry workflow library.
Stars: ✭ 21 (-68.18%)
Mutual labels:  async-await
optimistic lock coupling rs
🍋: A General Lock following paper "Optimistic Lock Coupling: A Scalable and Efficient General-Purpose Synchronization Method"
Stars: ✭ 21 (-68.18%)
Mutual labels:  concurrency
ProtoPromise
Robust and efficient library for management of asynchronous operations in C#/.Net.
Stars: ✭ 20 (-69.7%)
Mutual labels:  concurrency
pool
A highly flexible process pooling library for Node.js
Stars: ✭ 18 (-72.73%)
Mutual labels:  concurrency
Swift-Async-Await-Experiments
Experiments with Swift's new async/await feature (SE 0296)
Stars: ✭ 17 (-74.24%)
Mutual labels:  async-await
tomodachi
💻 Microservice library / framework using Python's asyncio event loop with full support for HTTP + WebSockets, AWS SNS+SQS, RabbitMQ / AMQP, middleware, etc. Extendable for GraphQL, protobuf, gRPC, among other technologies.
Stars: ✭ 170 (+157.58%)
Mutual labels:  async-await
fcsl-pcm
Partial Commutative Monoids
Stars: ✭ 20 (-69.7%)
Mutual labels:  concurrency

AwaitLock tests codecov

Mutex locks for async functions

npm package

Usage

import AwaitLock from 'await-lock';

let lock = new AwaitLock();

async function runSerialTaskAsync() {
  await lock.acquireAsync();
  try {
    // IMPORTANT: Do not return a promise from here because the finally clause
    // may run before the promise settles, and the catch clause will not run if
    // the promise is rejected
  } finally {
    lock.release();
  }
}

You can also use AwaitLock with co and generator functions.

import AwaitLock from 'await-lock';

let runSerialTaskAsync = co.wrap(function*() {
  yield lock.acquireAsync();
  try {
    // Run async code in the critical section
  } finally {
    lock.release();
  }
});
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].