diff --git a/Sharpen/Sharpen/ScheduledThreadPoolExecutor.cs b/Sharpen/Sharpen/ScheduledThreadPoolExecutor.cs index 50f2b6d91a0..ed67bdbf644 100755 --- a/Sharpen/Sharpen/ScheduledThreadPoolExecutor.cs +++ b/Sharpen/Sharpen/ScheduledThreadPoolExecutor.cs @@ -197,8 +197,6 @@ void SchedulerThread () { int nextWait = ST.Timeout.Infinite; while (true) { - if (nextWait != ST.Timeout.Infinite) - nextWait = Math.Max (0, nextWait); newTask.WaitOne (nextWait); lock (tasks) { DateTime now = DateTime.Now; @@ -209,7 +207,7 @@ void SchedulerThread () n--; } if (n < tasks.Count) - nextWait = (int) Math.Ceiling ((tasks[n].DueTime - DateTime.Now).TotalMilliseconds); + nextWait = Math.Max (0, (int) Math.Ceiling ((tasks[n].DueTime - DateTime.Now).TotalMilliseconds)); else nextWait = ST.Timeout.Infinite; }