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