protected void ReturnThis() { AsyncContext asyncContext = CurrentAsyncContext !; CurrentAsyncContext = null; CompletionFlags = OperationCompletionFlags.None; if (IsReadNotWrite) { asyncContext.ReturnReadOperation(this); } else { asyncContext.ReturnWriteOperation(this); } }
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); } }