Example #1
0
        protected void ReturnThis()
        {
            AsyncContext asyncContext = CurrentAsyncContext !;

            CurrentAsyncContext = null;
            CompletionFlags     = OperationCompletionFlags.None;

            if (IsReadNotWrite)
            {
                asyncContext.ReturnReadOperation(this);
            }
            else
            {
                asyncContext.ReturnWriteOperation(this);
            }
        }
Example #2
0
        private void ResetAndReturnThis()
        {
            // Capture context for return.
            AsyncContext asyncContext = CurrentAsyncContext !;

            // Reset
            _vts.Reset();
            _ctr.Dispose();
            _mre = null;
            CurrentAsyncContext = null;
            CompletionFlags     = OperationCompletionFlags.None;

            // Return
            if (_readNotWrite)
            {
                asyncContext.ReturnReadOperation(this);
            }
            else
            {
                asyncContext.ReturnWriteOperation(this);
            }
        }