FlushResult IWritableBufferAwaiter.GetResult() { var result = new FlushResult(); lock (_sync) { if (!_writerAwaitable.IsCompleted) { PipelinesThrowHelper.ThrowInvalidOperationException(ExceptionResource.GetResultNotCompleted); } // Change the state from to be cancelled -> observed if (_writerAwaitable.ObserveCancelation()) { result.ResultFlags |= ResultFlags.Cancelled; } if (_readerCompletion.IsCompletedOrThrow()) { result.ResultFlags |= ResultFlags.Completed; } } return(result); }
internal FlushResult GetFlushAsyncResult() { var result = new FlushResult(); lock (_sync) { if (!_writerAwaitable.IsCompleted) { ThrowHelper.ThrowInvalidOperationException_GetResultNotCompleted(); } // Change the state from to be canceled -> observed if (_writerAwaitable.ObserveCancelation()) { result._resultFlags |= ResultFlags.Canceled; } if (_readerCompletion.IsCompletedOrThrow()) { result._resultFlags |= ResultFlags.Completed; } } return(result); }