Beispiel #1
0
 public static void ThrowIfDisposedOrDisposing(this IHasDisposeStarted target)
 {
     if (target.IsDisposeStarted)
     {
         throw Errors.AlreadyDisposedOrDisposing();
     }
 }
Beispiel #2
0
 public void Increment()
 {
     lock (_lock) {
         if (DisposalState != DisposalState.Active)
         {
             throw Errors.AlreadyDisposedOrDisposing(DisposalState);
         }
         Count += 1;
         if (Count == 1)
         {
             _zeroSource = TaskSource.New <Unit>(_taskCreationOptions);
         }
     }
 }