/// <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() { ITestListener hostListeners = CoreExtensions.Host.Listeners; try { while (true) { Event e = this.events.Dequeue(this.PumpState == EventPumpState.Pumping); if (e == null) { break; } try { e.Send(this.eventListener); e.Send(hostListeners); } catch (Exception ex) { log.Error("Exception in event handler\r\n {0}", ex); } finally { if (e.IsSynchronous) { this.synchronousEventSent.Set(); } } } } catch (Exception ex) { log.Error("Exception in pump thread", ex); } finally { this.PumpState = EventPumpState.Stopped; //pumpThread = null; } }
/// <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"); } } }