0.0.6 • Published 9 years ago
timeout-semaphore v0.0.6
node-timeoutSemaphore
Semaphore with a timeout limit
Install: npm install semaphore
Limit simultaneous access to a resource.
// Create
var sem = require('semaphore')(capacity, timeoutMs_Or_0forInfinity);
// Take
sem.take((leaveFunc) => {
// Do what you want
var alreadyLeft = leaveFunc();
// Returns FALSE if the lock has been already released
}