CK.Monitoring.Impl.EventDispatcher.Run C# (CSharp) Method

Run() public method

public Run ( ) : void
return void
        void Run()
        {
            DateTime startIdleTime;
            for(;;)
            {
                EventItem e;
                while( _queue.TryDequeue( out e ) )
                {
                    _currentIdleCount = 0;
                    Interlocked.Decrement( ref _nonBlockingCount );
                    if( e.MustStop ) return;
                    e.Receiver.Dispatch( e.EventInfo );
                }
                startIdleTime = DateTime.UtcNow;
                for(;;)
                {
                    bool hasEvent = true;
                    lock( _dispatchLock )
                        while( _queue.IsEmpty )
                            hasEvent = Monitor.Wait( _dispatchLock, _idleManager( _currentIdleCount++ ) );
                    if( hasEvent ) break;
                    if( _onIdle != null ) _onIdle( DateTime.UtcNow - startIdleTime );
                }
            }
        }