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