Exemplo n.º 1
0
            internal ExitLock(Action releaseLockAction)
            {
                releaseLockAction.ArgumentNotNull(nameof(releaseLockAction));

                _releaseLockAction = releaseLockAction;
                _disposed          = new InterlockedBoolean(false);
            }
Exemplo n.º 2
0
        /// <inheritdoc/>
        public void Dispose()
        {
            if (_isDisposed)
            {
                // already disposed
                return;
            }

            if (_isDisposing.ExchangeValue(true))
            {
                // already disposing
                return;
            }

            Dispose(true);
            _isDisposing = false;
            _isDisposed  = true;
        }
Exemplo n.º 3
0
 /// <inheritdoc />
 public bool Equals(InterlockedBoolean other)
 {
     return(Equals(other.GetValue()));
 }
Exemplo n.º 4
0
 /// <inheritdoc />
 public int CompareTo(InterlockedBoolean other)
 {
     return(GetValue().CompareTo(other.GetValue()));
 }
Exemplo n.º 5
0
 /// <summary>
 ///    Converts the given <paramref name="value" /> instance to a <see cref="Boolean" />.
 /// </summary>
 /// <param name="value">
 ///    The value to convert.
 /// </param>
 /// <returns>
 ///    The <see cref="Boolean" /> representation of <paramref name="value" />.
 /// </returns>
 public static bool ToBoolean(InterlockedBoolean value)
 {
     return(value.GetValue());
 }