private void AwaitResponse(long correlationId)
        {
            _driverException = null;
            var deadlineNs = _nanoClock.NanoTime() + _driverTimeoutNs;

            do
            {
                try
                {
                    Thread.Sleep(1);
                }
                catch (ThreadInterruptedException)
                {
                    Thread.CurrentThread.Interrupt();
                    throw;
                }

                Service(correlationId);

                if (_driverEventsAdapter.ReceivedCorrelationId() == correlationId)
                {
                    if (null != _driverException)
                    {
                        throw _driverException;
                    }

                    return;
                }

                Thread.Sleep(0); // check interrupt
            } while (deadlineNs - _nanoClock.NanoTime() > 0);

            throw new DriverTimeoutException("no response from MediaDriver within (ms):" + _driverTimeoutMs);
        }
Exemple #2
0
        private void AwaitResponse(long correlationId)
        {
            _driverException = null;
            var deadlineNs = _nanoClock.NanoTime() + _driverTimeoutNs;

            do
            {
                Aeron.Sleep(1);

                Service(correlationId);

                if (_driverEventsAdapter.ReceivedCorrelationId() == correlationId)
                {
                    if (null != _driverException)
                    {
                        throw _driverException;
                    }

                    return;
                }
            } while (_nanoClock.NanoTime() < deadlineNs);

            throw new DriverTimeoutException("No response from MediaDriver within (ms):" + _driverTimeoutMs);
        }