/// <summary> /// Initiate operation of the Poller associated with this device, /// if this device owns it. /// This also sets IsRunning to true. /// </summary> public void Run() { IsRunning = true; if (m_pollerIsOwned && !m_poller.IsRunning) { m_poller.Run(); } }
/// <summary> /// Start proxying messages between the front and back ends. Blocks, unless using an external <see cref="NetMQPoller"/>. /// </summary> /// <exception cref="InvalidOperationException">The proxy has already been started.</exception> public void Start() { if (Interlocked.CompareExchange(ref m_state, StateStarting, StateStopped) != StateStopped) { throw new InvalidOperationException("Proxy has already been started"); } m_frontend.ReceiveReady += OnFrontendReady; m_backend.ReceiveReady += OnBackendReady; if (m_externalPoller) { m_state = StateStarted; } else { m_poller = new NetMQPoller { m_frontend, m_backend }; m_state = StateStarted; m_poller.Run(); } }