Renci.SshNet.Sftp.SubsystemSession.WaitHandle C# (CSharp) Method

WaitHandle() private method

private WaitHandle ( WaitHandle waitHandle, System.TimeSpan operationTimeout ) : void
waitHandle System.Threading.WaitHandle
operationTimeout System.TimeSpan
return void
        internal void WaitHandle(WaitHandle waitHandle, TimeSpan operationTimeout)
        {
            var waitHandles = new WaitHandle[]
                {
                    this._errorOccuredWaitHandle,
                    this._channelClosedWaitHandle,
                    waitHandle,
                };

            switch (EventWaitHandle.WaitAny(waitHandles, operationTimeout))
            {
                case 0:
                    {
                        var exception = this._exception;
                        this._exception = null;
                        throw exception;
                    }
                case 1:
                    throw new SshException("Channel was closed.");
                case System.Threading.WaitHandle.WaitTimeout:
                    throw new SshOperationTimeoutException(string.Format(CultureInfo.CurrentCulture, "Operation has timed out."));
                default:
                    break;
            }
        }