System.Threading.ReaderWriterLockSlim.ExitWriteLock C# (CSharp) Method

ExitWriteLock() public method

public ExitWriteLock ( ) : void
return void
		public void ExitWriteLock ()
		{
			EnterMyLock ();

			if (owners != -1) {
				ExitMyLock ();
				throw new SynchronizationLockException ("Calling ExitWriterLock when no write lock is held");
			}

			//Debug.Assert (numUpgradeWaiters > 0);
			if (upgradable_thread == Thread.CurrentThread)
				owners = 1;
			else
				owners = 0;
			write_thread = null;
			ExitAndWakeUpAppropriateWaiters ();
		}

Usage Example

Example #1
0
        public bool EnQueue(T item)
        {
            locker.EnterWriteLock();

            var isSuccess = false;

            if (keyList.Add(item))
            {
                var indexStart = _rear;

                _rear = (indexStart + 1) % _capacity;

                if (_rear == _front)
                {
                    _front = (++_front) % _capacity;
                }

                valueList[indexStart] = item;

                UpdateCount(1);

                isSuccess = true;
            }

            locker.ExitWriteLock();

            return(isSuccess);
        }
All Usage Examples Of System.Threading.ReaderWriterLockSlim::ExitWriteLock