private SemaphoreSlim GetSemaphoreForContainer(string container)
 {
     lock (Semaphores)
     {
         var semaphore = Semaphores.GetValueOrDefault(container);
         if (semaphore == null)
         {
             semaphore = new SemaphoreSlim(1, 1);
             Semaphores.Add(container, semaphore);
         }
         return(semaphore);
     }
 }
Пример #2
0
 private SemaphoreSlim GetSemaphoreForPayment(int paymentId)
 {
     lock (semaphores)
     {
         var semaphore = semaphores.GetValueOrDefault(paymentId);
         if (semaphore == null)
         {
             semaphore = new SemaphoreSlim(1, 1);
             semaphores.Add(paymentId, semaphore);
         }
         return(semaphore);
     }
 }