Exemplo n.º 1
0
        public InterlockedLock(Locker _locker)
        {
            this.locker = _locker;

            int count = 0;

            while (!locker.TryEnterLock())
            {
                count++;
                Thread.Sleep(1);

                if (count > timeout)
                {
                    throw new LockTimeoutException("Unable to lock collection");
                }
            }
        }
Exemplo n.º 2
0
        public InterlockedLock(Locker _locker)
        {
            this.locker = _locker;

            int count = 0;
            while (!locker.TryEnterLock())
            {
                count++;
                Thread.Sleep(1);

                if (count > timeout)
                    throw new LockTimeoutException("Unable to lock collection");
            }
        }