Пример #1
0
 public Promise(bool done)
 {
     _exception = null;
     _hashCode  = base.GetHashCode();
     if (!done)
     {
         _waitHandle = new ManualResetEventSlim(false);
     }
 }
Пример #2
0
        private static bool EqualsExtracted(StructNeedle <T> left, StructNeedle <T> right)
        {
            var leftValue = left.Value;

            if (left.IsAlive)
            {
                var rightValue = right.Value;
                return(right.IsAlive && EqualityComparer <T> .Default.Equals(leftValue, rightValue));
            }
            return(!right.IsAlive);
        }
Пример #3
0
 public Promise(Exception exception)
 {
     _exception  = exception;
     _hashCode   = exception.GetHashCode();
     _waitHandle = new ManualResetEventSlim(true);
 }
Пример #4
0
 public bool Equals(StructNeedle <T> other)
 {
     return(EqualsExtracted(this, other));
 }