private static void VerifyQueue(EventQueue q) { for (int index = 0; index < events.Length; index++) { Event e = q.Dequeue(false); Assert.AreEqual(events[index].GetType(), e.GetType(), string.Format("Event {0}", index)); } }
private static void VerifyQueue(EventQueue q) { for (int index = 0; index < events.Length; index++) { Event e = q.Dequeue(false); Assert.AreEqual(events[index].GetType(), e.GetType(), string.Format("Event {0}", index)); } }
/// <summary> /// Our thread proc for removing items from the event /// queue and sending them on. Note that this would /// need to do more locking if any other thread were /// removing events from the queue. /// </summary> private void PumpThreadProc() { log.Debug("Starting EventPump"); //ITestListener hostListeners = CoreExtensions.Host.Listeners; try { while (true) { Event e = _events.Dequeue(PumpState == EventPumpState.Pumping); if (e == null) { break; } try { e.Send(_eventListener); //e.Send(hostListeners); } catch (Exception ex) { log.Error("Exception in event handler {0}", ExceptionHelper.BuildStackTrace(ex)); } } log.Debug("EventPump Terminating"); } catch (Exception ex) { log.Error("Exception in pump thread {0}", ExceptionHelper.BuildStackTrace(ex)); } finally { _pumpState = (int)EventPumpState.Stopped; //pumpThread = null; if (_events.Count > 0) { log.Error("Event pump thread exiting with {0} events remaining"); } } }
public void DequeueEmpty() { EventQueue q = new EventQueue(); Assert.IsNull(q.Dequeue(false)); }
public void DequeueEmpty() { EventQueue q = new EventQueue(); Assert.IsNull(q.Dequeue(false)); }