fix: Fixes Timer.Pause not running continuation (#1893)
This commit is contained in:
parent
4d47b3849f
commit
8f39af9579
2 changed files with 20 additions and 6 deletions
|
|
@ -142,7 +142,7 @@ public partial class Timer
|
|||
// Stop the timer from running so that way if Start() is called in OnTick, the timer will be started.
|
||||
if (finished)
|
||||
{
|
||||
timer.Stop();
|
||||
timer.InternalStop();
|
||||
}
|
||||
|
||||
var version = timer.Version;
|
||||
|
|
@ -151,11 +151,19 @@ public partial class Timer
|
|||
prof?.Finish();
|
||||
|
||||
// If the timer has been altered (restarted, returned etc) then bail
|
||||
if (finished || timer.Version != version)
|
||||
if (timer.Version != version)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (finished)
|
||||
{
|
||||
// Already stopped and detached, now run OnDetach
|
||||
timer.OnDetach();
|
||||
timer.Version++;
|
||||
return;
|
||||
}
|
||||
|
||||
timer.Delay = timer.Interval;
|
||||
timer.Next = DateTime.UtcNow + timer.Interval;
|
||||
AddTimer(timer, (long)timer.Delay.TotalMilliseconds);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue