public static void End( IAsyncResult result, object owner, string operationId) { AsyncResultNoResult asyncResult = result as AsyncResultNoResult; if (asyncResult == null) { throw new ArgumentException( "Result passed represents an operation not supported " + "by this framework.", "result"); } asyncResult.CheckUsage(owner, operationId); // This method assumes that only 1 thread calls EndInvoke // for this object if (!asyncResult.IsCompleted) { // If the operation isn't done, wait for it asyncResult.AsyncWaitHandle.WaitOne(); asyncResult.AsyncWaitHandle.Close(); asyncResult.m_AsyncWaitHandle = null; // Allow early GC } // Operation is done: if an exception occurred, throw it if (asyncResult.m_exception != null) { logger.Error("Exception in AsyncResultNoResult.End", asyncResult.m_exception); } }
protected virtual void MakeCallback( AsyncCallback callback, AsyncResultNoResult result) { // If a callback method was set, call it if (callback != null) { callback(result); } }