public static TaskThrottler Get(string name, int?concurrentItems = null) { _lock.EnterUpgradeableReadLock(); try { if (Throttles.ContainsKey(name)) { return(Throttles[name]); } _lock.EnterWriteLock(); try { var newThrottle = new TaskThrottler(name, concurrentItems ?? 10); Throttles.Add(name, newThrottle); Debug.WriteLine("Added name"); return(newThrottle); } finally { _lock.ExitWriteLock(); } } finally { _lock.ExitUpgradeableReadLock(); } }
internal Releaser(TaskThrottler toRelease) { m_toRelease = toRelease; }