NetMQ.NetMQPoller.Stop C# (CSharp) Method

Stop() public method

Stops the poller, blocking until stopped.
public Stop ( ) : void
return void
        public void Stop()
        {
            CheckDisposed();
            if (!IsRunning)
                throw new InvalidOperationException("NetMQPoller is not running");

            // Signal the poller to stop
            m_stopSignaler.RequestStop();

            // If 'stop' was requested from the scheduler thread, we cannot block
#if NET35
            if (m_pollerThread != Thread.CurrentThread)
#else
            if (!m_isSchedulerThread.Value)
#endif
            {
                m_switch.WaitForOff();
                Debug.Assert(!IsRunning);
            }
        }

Usage Example

Example #1
0
        public void Run(CancellationToken cancellationToken, params Task[] tasks)
        {
            var registration = cancellationToken.Register(() => m_poller.Stop(), true);

            Task.WhenAll(tasks).ContinueWith(t => m_poller.Stop(), cancellationToken);

            m_poller.Run(m_synchronizationContext);

            registration.Dispose();
        }
All Usage Examples Of NetMQ.NetMQPoller::Stop