internal void ErrorCleanup() { if (pOverlapped != null) { Overlapped.Unpack(pOverlapped); Overlapped.Free(pOverlapped); pOverlapped = null; } AsyncWaitHandle.Close(); }
internal byte[] End( ) // Wait for completion + rethrow any error. { AsyncWaitHandle.WaitOne( ); AsyncWaitHandle.Close( ); if (_exception != null) { throw _exception; } return(_data); }
void Dispose(bool disposing) { if (disposing) { if (AsyncWaitHandle != null) { AsyncWaitHandle.Close(); } } }
internal void EndInvoke() { AsyncWaitHandle.WaitOne(); AsyncWaitHandle.Close(); _completedWaitHandle = null; // allow early GC if (null != _exception) { throw _exception; } }
public T FetchResultsFromAsyncOperation() { if (!_isCompleted) { AsyncWaitHandle.WaitOne(); AsyncWaitHandle.Close(); } if (_exception != null) { throw _exception; } return(_result); }
internal int Complete() { lock (MonitorWaitHandle) if (!IsCompleted) { Monitor.Wait(MonitorWaitHandle); } if (ErrorCode != 0) { throw new Win32Exception(ErrorCode); } AsyncWaitHandle.Close(); return(Result); }
public void EndInvoke() { if (!IsCompleted) { AsyncWaitHandle.WaitOne(); AsyncWaitHandle.Close(); m_AsyncWaitHandle = null; } if (m_exception != null) { throw m_exception; } }
/// <summary> /// Task EndXXX method called /// </summary> public void EndInvoke() { if (!IsCompleted) { AsyncWaitHandle.WaitOne(); AsyncWaitHandle.Close(); _waitHandle = null; } if (_terminatingException != null) { throw _terminatingException; } }
/// <summary> /// 等待同步完成,它将阻塞当前线程,直至等待超过timeout时限,或等待事件被设置。 /// </summary> /// <param name="timeout">等待的毫秒数。-1表示无限期等待。</param> public void EndInvoke(int timeout) { // This method assumes that only 1 thread calls EndInvoke for this object if (!IsCompleted) { // If the operation isn't done, wait for it //Translated from Java, -1 means wait to done if (-1 == timeout) { timeout = 0; } AsyncWaitHandle.WaitOne(timeout, false); AsyncWaitHandle.Close(); asyncWaitHandle = null; } }
public void EndInvoke() { // This method assumes that only 1 thread calls EndInvoke for this object if (!IsCompleted) { // If the operation isn't done, wait for it AsyncWaitHandle.WaitOne(); AsyncWaitHandle.Close(); m_AsyncWaitHandle = null; // Allow early GC } // Operation is done: if an exception occured, throw it if (m_exception != null) { throw m_exception; } }
/// <summary> /// Waits until the asynchronous operation completes, and then returns. /// </summary> public void EndInvoke() { // This method assumes that only 1 thread calls EndInvoke for this object if (!this.IsCompleted) { // If the operation isn't done, wait for it AsyncWaitHandle.WaitOne(); AsyncWaitHandle.Close(); this._asyncWaitHandle = null; // Allow early GC } this.EndInvokeCalled = true; // Operation is done: if an exception occurred, throw it if (this._exception != null) { throw new SshException(this._exception.Message, this._exception); } }
internal void Get() { if (IsCompleted == false) { try { AsyncWaitHandle.WaitOne(); } finally { AsyncWaitHandle.Close(); } } if (exception != null) { throw exception; } }
internal void EndInvoke(bool canThrowException) { // This method assumes that only 1 thread calls EndInvoke // for this object if (!IsCompleted) { // If the operation isn't done, wait for it AsyncWaitHandle.WaitOne(); AsyncWaitHandle.Close(); _asyncWaitHandle = null; // Allow early GC } // Operation is done: if an error occured, throw it if (canThrowException) { if (SocketError != RUDPSocketError.Success) { throw new RUDPSocketException(SocketError); } } }
public void EndInvoke() { // This method assumes that only 1 thread calls EndInvoke // for this object if (!IsCompleted) { // If the operation isn't done, wait for it AsyncWaitHandle.WaitOne(); #if (NETCOREAPP1_0 || NETCOREAPP2_0) AsyncWaitHandle.Dispose(); #else AsyncWaitHandle.Close(); #endif this.asyncWaitHandle = null; // Allow early GC } // Operation is done: if an exception occured, throw it if (this.exception != null) { throw this.exception; } }
public void EndInvoke() { // This method assumes that only 1 thread calls EndInvoke // for this object if (!IsCompleted) { // If the operation isn't done, wait for it AsyncWaitHandle.WaitOne(); AsyncWaitHandle.Close(); m_AsyncWaitHandle = null; // Allow early GC } // Operation is done: if an exception occured, throw it if (m_exception != null) { throw new Exception(String.Format( "{0} was thrown in thread #{1} carrying state ({2}).", m_exception.GetType().FullName, Thread.CurrentThread.ManagedThreadId, m_AsyncState), m_exception); } }
public void EndInvoke() { Log("EndInvoke (enter)"); // This method assumes that only 1 thread calls EndInvoke // for this object if (!IsCompleted) { Log("Waiting on handle..."); // If the operation isn't done, wait for it AsyncWaitHandle.WaitOne(); AsyncWaitHandle.Close(); _resetEvent = null; // Allow early GC } // Operation is done: if an exception occured, throw it if (_exception != null) { Log("Exception encountered: {0}", _exception.Message); throw _exception; } Log("EndInvoke (exit)"); }