public static XAsyncLock Get(string name) { _lock.EnterUpgradeableReadLock(); try { if (Locks.ContainsKey(name)) { return(Locks[name]); } _lock.EnterWriteLock(); try { var newLock = new XAsyncLock(); Locks.Add(name, newLock); return(newLock); } finally { _lock.ExitWriteLock(); } } finally { _lock.ExitUpgradeableReadLock(); } }
public static XAsyncLock Get(string name) { _lock.EnterUpgradeableReadLock(); try { if (Locks.ContainsKey(name)) { return Locks[name]; } _lock.EnterWriteLock(); try { var newLock = new XAsyncLock(); Locks.Add(name, newLock); return newLock; } finally { _lock.ExitWriteLock(); } } finally { _lock.ExitUpgradeableReadLock(); } }
internal Releaser(XAsyncLock toRelease) { m_toRelease = toRelease; }