private void RunnerNotifier() { while (!this.cancelToken.IsCancellationRequested) { UpnpEngineDevice selectedDevice = this.GetMinNextNotification(); if (selectedDevice == null) { this.waitHandle.WaitOne(); } else { DateTime lastNotification = selectedDevice.GetNextNotification(); if (lastNotification < DateTime.UtcNow.AddSeconds(5)) { selectedDevice.Notifiy(); } else { this.waitHandle.WaitOne(lastNotification - DateTime.UtcNow); } } } }