예제 #1
0
        internal float CompareWith(LockGroup lockGroup)
        {
            float sum = 0;
            SortedSet <LockState> Except = this.LockStates;

            Except.ExceptWith(lockGroup.LockStates);
            foreach (LockState ls in Except)
            {
                sum += ls.Size;
            }
            return(sum);
        }
예제 #2
0
파일: LockRequest.cs 프로젝트: vebin/BD2
 public LockRequest(TimeSpan Timeout, Action<LockRequest> Acquired, LockGroup lockGroup)
 {
     if (Acquired == null)
         throw new ArgumentNullException ("Acquired");
     if (lockGroup == null)
         throw new ArgumentNullException ("lockGroup");
     acquired = Acquired;
     timeout = Timeout;
     this.lockGroup = lockGroup;
     timeRequested = DateTime.UtcNow;
     timeAcquired = DateTime.MinValue;
 }
예제 #3
0
 public LockRequest(TimeSpan Timeout, Action <LockRequest> Acquired, LockGroup lockGroup)
 {
     if (Acquired == null)
     {
         throw new ArgumentNullException("Acquired");
     }
     if (lockGroup == null)
     {
         throw new ArgumentNullException("lockGroup");
     }
     acquired       = Acquired;
     timeout        = Timeout;
     this.lockGroup = lockGroup;
     timeRequested  = DateTime.UtcNow;
     timeAcquired   = DateTime.MinValue;
 }
예제 #4
0
 internal void TryAcquire(LockGroup Group)
 {
     lock (lock_status) {
         if (Status == LockStatus.Unlocked)
         {
             lock (lockManager.LockAccess) {
                 foreach (var LockState in lockManager.Locks)
                 {
                     if (LockState.Key != this)
                     {
                         if (!LockState.Key.CanCoexistWith(this))
                         {
                             return;
                         }
                     }
                 }
                 if (VerifyObjects())
                 {
                     stateChanged(this);
                 }
             }
         }
     }
 }
예제 #5
0
파일: LockGroup.cs 프로젝트: vebin/BD2
 internal float CompareWith(LockGroup lockGroup)
 {
     float sum = 0;
     SortedSet<LockState> Except = this.LockStates;
     Except.ExceptWith (lockGroup.LockStates);
     foreach (LockState ls in Except) {
         sum += ls.Size;
     }
     return sum;
 }
예제 #6
0
 internal override void Schedule(LockGroup lockGroup)
 {
     throw new NotImplementedException();
 }
예제 #7
0
 internal abstract void Schedule(LockGroup lockGroup);
예제 #8
0
 internal override void Schedule(LockGroup lockGroup)
 {
     lock (LGs) {
         LGs.Add(lockGroup);
     }
 }
예제 #9
0
 internal override void Schedule(LockGroup lockGroup)
 {
     lock (LGs)
         LGs.Enqueue(lockGroup);
 }
예제 #10
0
파일: LockState.cs 프로젝트: vebin/BD2
 internal void TryAcquire(LockGroup Group)
 {
     lock (lock_status) {
         if (Status == LockStatus.Unlocked) {
             lock (lockManager.LockAccess) {
                 foreach (var LockState in lockManager.Locks) {
                     if (LockState.Key != this)
                     if (!LockState.Key.CanCoexistWith (this)) {
                         return;
                     }
                 }
                 if (VerifyObjects ()) {
                     stateChanged (this);
                 }
             }
         }
     }
 }