Esempio n. 1
0
            public void UpgradeToWriteLock()
            {
                if (write)
                {
                    throw new InvalidOperationException("Lock already upgraded");
                }

                // it is important that these never throw exceptions, they shouldn't ever
                // because Interlocked should never throw
                locker.WaitForWriteLock();
                write = true;
            }
Esempio n. 2
0
            public ReaderWriterLockAsyncLocker(ReaderWriterLockAsync locker, bool write)
            {
                this.locker = locker;
                this.write  = write;

                // it is important that these never throw exceptions, they shouldn't ever
                // because Interlocked should never throw
                locker.WaitForReadLock();
                if (write)
                {
                    locker.WaitForWriteLock();
                }
            }