src/Foundation/ServiceModel/Gimela.ServiceModel.ManagedDiscovery/DiscoveryProxy/AsyncResult/AsyncResult.cs
/// <summary>
/// Completes the specified completed synchronously.
/// Call this version of complete when your asynchronous operation is complete.  This will update the state
/// of the operation and notify the callback.
/// </summary>
/// <param name="completedSynchronously">if set to <c>true</c> [completed synchronously].</param>
Completes the specified completed synchronously.
Call this version of complete when your asynchronous operation is complete.  This will update the state
of the operation and notify the callback.
Completes the specified completed synchronously . Call this version of complete when your asynchronous operation is complete . This will update the state of the operation and notify the callback .
protected void Complete(bool completedSynchronously)
    {
      if (this.isCompleted)
      {
        throw new InvalidOperationException("This async result is already completed.");
      }
      this.CompletedSynchronously = completedSynchronously;
      if (completedSynchronously)
      {
        this.isCompleted = true;
      }
      else
      {
        lock (this.operationLock)
        {
          this.isCompleted = true;
          if (this.manualResetEvent != null)
          {
            this.manualResetEvent.Set();
          }
        }
      }
      if (this.callback != null)
      {
        this.callback(this);
      }
    }
protected void Complete ( bool completedSynchronously ) { if ( this . isCompleted ) { throw new InvalidOperationException ( " " ) ; } this . CompletedSynchronously = completedSynchronously ; if ( completedSynchronously ) { this . isCompleted = true ; } else { lock ( this . operationLock ) { this . isCompleted = true ; if ( this . manualResetEvent != null ) { this . manualResetEvent . Set ( ) ; } } } if ( this . callback != null ) { this . callback ( this ) ; } }
Completes the specified completed synchronously.
Completes the specified completed synchronously .
// It's a bug to call Complete twice. // If the callback throws, there is a bug in the callback implementation
completedSynchronously
bool
if set to true
if set to true