Asynchronous resources, generator style. Finally, Javascript has deadlocks!
$ npm install co-lock
var release = yield lock(target);
// critical section
yield release;
Creates a lock on target
, yields with release
when the lock can be acquired.
If cannot acquire lock within timeout
, throws error.
Yielding release
gives control to the next thread in the lock's queue.
MIT