Fixed a glaring bug in the Scheduler causing errors when the scheduler's last item in the queue is cancelled

git-svn-id: file:///srv/devel/repo-conversion/nusu@152 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2009-06-22 18:14:45 +00:00
parent b38284d372
commit f8adca9e17

View File

@ -465,19 +465,18 @@ namespace Nuclex.Support.Scheduling {
/// <summary>Retrieves the notification that is due next</summary> /// <summary>Retrieves the notification that is due next</summary>
/// <returns>The notification that is due next</returns> /// <returns>The notification that is due next</returns>
private Notification getNextDueNotification() { private Notification getNextDueNotification() {
if(this.notifications.Count == 0) { while(this.notifications.Count > 0) {
return null;
} else {
Notification nextDueNotification = this.notifications.Peek(); Notification nextDueNotification = this.notifications.Peek();
while(nextDueNotification.Cancelled) { if(nextDueNotification.Cancelled) {
this.notifications.Dequeue(); this.notifications.Dequeue();
nextDueNotification = this.notifications.Peek(); } else {
}
return nextDueNotification; return nextDueNotification;
} }
} }
return null;
}
/// <summary>Time source used by the scheduler</summary> /// <summary>Time source used by the scheduler</summary>
private ITimeSource timeSource; private ITimeSource timeSource;
/// <summary>Thread that will wait for the next scheduled event</summary> /// <summary>Thread that will wait for the next scheduled event</summary>