Exemple #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");
                }
            }
        }
        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");
            }
        }