public void RelaseLock(Lock ownedLock) { lock (_locks) { _locks.Remove(ownedLock); } }
public Lock GetLock(DataLocation location) { Lock newLock; lock (_locks) { foreach (Lock takenLock in _locks) { if (takenLock.Overlap(location)) return null; } newLock = new Lock(location); _locks.Add(newLock); } return newLock; }
public bool Overlap(Lock lock2) { return Overlap(lock2.StartLocation) || Overlap(lock2.EndLocation); }
public bool Equals(Lock other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return other.StartLocation.Equals(StartLocation) && other.EndLocation.Equals(EndLocation); }