Exemplo n.º 1
0
        private void IncrementAllocation(ReservationAllocation reservation)
        {
            System.Diagnostics.Debug.Assert((readWriteLock.IsWriteLockedByCurrentThread()));
            IDictionary <ReservationInterval, ReservationRequest> allocationRequests = reservation
                                                                                       .GetAllocationRequests();
            // check if we have encountered the user earlier and if not add an entry
            string user = reservation.GetUser();
            RLESparseResourceAllocation resAlloc = userResourceAlloc[user];

            if (resAlloc == null)
            {
                resAlloc = new RLESparseResourceAllocation(resCalc, minAlloc);
                userResourceAlloc[user] = resAlloc;
            }
            foreach (KeyValuePair <ReservationInterval, ReservationRequest> r in allocationRequests)
            {
                resAlloc.AddInterval(r.Key, r.Value);
                rleSparseVector.AddInterval(r.Key, r.Value);
            }
        }
Exemplo n.º 2
0
 public virtual bool IsWriteLockedByCurrentThread()
 {
     return(coarseLock.IsWriteLockedByCurrentThread());
 }