/// <summary> /// Wait for a notification to be queued, then notify all /// listeners listed in the notification. /// </summary> public override void Run() { IEventListener[] list; while (true) { #if !NETSTANDARD1_3 try { #endif lock (this) { while (queue.Count == 0) { Monitor.Wait(this); } list = queue[0]; queue.RemoveAt(0); } for (int i = 0; i < list.Length; ++i) { notifier.NotifyListener(list[i]); } #if !NETSTANDARD1_3 } catch (ThreadInterruptedException) { } #endif } }
/// <summary> /// Wait for a notification to be queued, then notify all /// listeners listed in the notification. /// </summary> public override void Run() { IEventListener[] list; while (true) { #if FEATURE_THREADINTERRUPT try { #endif lock (this) { while (queue.Count == 0) { Monitor.Wait(this); } list = queue.Dequeue(); } for (int i = 0; i < list.Length; ++i) { notifier.NotifyListener(list[i]); } #if FEATURE_THREADINTERRUPT } catch (ThreadInterruptedException) { } #endif } }