You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
433 B

var $ = require('preconditions').singleton();
var _ = require('lodash');
var LocalLock = require('./locallock');
var RemoteLock = require('locker');
10 years ago
function Lock(opts) {};
10 years ago
Lock.prototype.runLocked = function(token, cb, task) {
$.shouldBeDefined(token);
10 years ago
LocalLock.get(token, function(lock) {
var _cb = function() {
cb.apply(null, arguments);
lock.free();
};
task(_cb);
});
10 years ago
};
module.exports = Lock;