On very quickly scheduled recurrent notifications, it was still possible for the wait time to become negative due to the passage of time - now the scheduler will only use the WaitOne() method when the remaining time until notification is positive

git-svn-id: file:///srv/devel/repo-conversion/nusu@147 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2009-06-09 19:47:30 +00:00
parent 6b8362d57d
commit d6ddf04f58

View File

@ -419,7 +419,9 @@ namespace Nuclex.Support.Scheduling {
this.notificationWaitEvent.WaitOne(); this.notificationWaitEvent.WaitOne();
} else { } else {
long remainingTicks = nextDueNotification.NextDueTicks - this.timeSource.Ticks; long remainingTicks = nextDueNotification.NextDueTicks - this.timeSource.Ticks;
this.timeSource.WaitOne(this.notificationWaitEvent, remainingTicks); if(remainingTicks > 0) {
this.timeSource.WaitOne(this.notificationWaitEvent, remainingTicks);
}
} }
// Have we been woken up because the Scheduler is being disposed? // Have we been woken up because the Scheduler is being disposed?