示例#1
0
            internal (Status, Output) CompleteRead()
            {
                (Status, Output)_result = default;
                if (_diskRequest.asyncOperation != null &&
                    CompletionComputeStatus != Completed &&
                    Interlocked.CompareExchange(ref CompletionComputeStatus, Completed, Pending) == Pending)
                {
                    try
                    {
                        if (_clientSession.SupportAsync)
                        {
                            _clientSession.UnsafeResumeThread();
                        }
                        try
                        {
                            Debug.Assert(_fasterKV.RelaxedCPR);

                            _result = _fasterKV.InternalCompletePendingReadRequest(
                                _clientSession.ctx, _clientSession.ctx, _diskRequest, _pendingContext);
                        }
                        finally
                        {
                            if (_clientSession.SupportAsync)
                            {
                                _clientSession.UnsafeSuspendThread();
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        _exception = ExceptionDispatchInfo.Capture(e);
                    }
                    finally
                    {
                        _clientSession.ctx.ioPendingRequests.Remove(_pendingContext.id);
                        _clientSession.ctx.asyncPendingCount--;
                    }
                }

                if (_exception != default)
                {
                    _exception.Throw();
                }
                return(_result);
            }