public Task <bool> LockAsync(long key, int appId, int time) { if (!this.lockDict.ContainsKey(key)) { this.Lock(key, appId, time); return(Task.FromResult(true)); } LocationLockTask task = new LocationLockTask(key, appId, time); this.AddTask(key, task); return(task.Task); }
public Task <bool> LockAsync(long key) { if (!this.lockSet.Contains(key)) { this.Lock(key); return(Task.FromResult(true)); } LocationLockTask task = new LocationLockTask(key); this.AddTask(key, task); return(task.Task); }