예제 #1
0
        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();
            }
        }
예제 #2
0
        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();
            }
        }
예제 #3
0
 internal Releaser(XAsyncLock toRelease)
 {
     m_toRelease = toRelease;
 }
예제 #4
0
 internal Releaser(XAsyncLock toRelease) { m_toRelease = toRelease; }