public void Change (Timer timer, long new_next_run)
{
lock (this) {
InternalRemove (timer);
if (new_next_run == Int64.MaxValue) {
timer.next_run = new_next_run;
return;
}
if (!timer.disposed) {
// We should only change next_run after removing and before adding
timer.next_run = new_next_run;
Add (timer);
// If this timer is next in line, wake up the scheduler
if (list.GetByIndex (0) == timer)
Monitor.Pulse (this);
}
}
}