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); } }
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); } }