Ejemplo n.º 1
0
 public void RelaseLock(Lock ownedLock)
 {
     lock (_locks)
     {
         _locks.Remove(ownedLock);
     }
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 public bool Overlap(Lock lock2)
 {
     return Overlap(lock2.StartLocation) || Overlap(lock2.EndLocation);
 }
Ejemplo n.º 4
0
 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);
 }