private void SetComplete(Exception ex, byte[] resultingBuffer)
            {
                lock (locker)
                {
                    if (completed)
                    {
                        return;
                    }

                    completed        = true;
                    _asyncException  = ex;
                    _resultingBuffer = resultingBuffer;
                    if (handle != null)
                    {
                        handle.Set();
                    }

                    if (_userCallback != null)
#if SSHARP
                    { _userCallback.BeginInvokeEx(this, null, null); }
#else
                    { _userCallback.BeginInvoke(this, null, null); }
#endif
                }
            }
            public void SetComplete(Exception ex)
            {
                lock (locker)
                {
                    if (completed)
                    {
                        return;
                    }

                    completed = true;
                    if (handle != null)
                    {
                        handle.Set();
                    }

                    if (_userCallback != null)
#if SSHARP
                    { _userCallback.BeginInvokeEx(this, null, null); }
#else
                    { _userCallback.BeginInvoke(this, null, null); }
#endif

                    _asyncException = ex;
                }
            }
示例#3
0
        public void Complete()
        {
            lock (locker)
            {
                if (completed)
                {
                    return;
                }

                completed = true;
                if (handle != null)
                {
                    handle.Set();
                }

                if (Callback != null)
#if SSHARP
                { Callback.BeginInvokeEx(this, null, null); }
#else
                { Callback.BeginInvoke(this, null, null); }
#endif
            }
        }
            private void SetComplete(Exception ex, int bytesRead)
            {
                lock (locker)
                {
                    if (completed)
                    {
                        return;
                    }

                    completed       = true;
                    _asyncException = ex;
                    _bytesRead      = bytesRead;
                    if (handle != null)
                    {
                        handle.Set();
                    }
                }
                if (_userCallback != null)
#if SSHARP
                { _userCallback.BeginInvokeEx(this, null, null); }
#else
                { _userCallback.BeginInvoke(this, null, null); }
#endif
            }