diff --git a/Timer.st b/Timer.st index 4073a1d..19c2471 100644 --- a/Timer.st +++ b/Timer.st @@ -67,7 +67,7 @@ Object subclass: Timer [ ] Object subclass: TimerScheduler [ - | queue sem loop quit | + | queue sem loop quit lastDelay | [quit] whileFalse: [ | now | - (Delay forSeconds: 1) wait. + "Remember the last delay so we can interrupt it on image resume on Pharo" + lastDelay := Delay forSeconds: 1. + lastDelay wait. + lastDelay := nil. + now := DateTime now. OsmoDispatcher dispatchBlock: [self fireTimers: now]. ] diff --git a/changes_for_pharo.st b/changes_for_pharo.st index 176bb7c..f4dc8a9 100644 --- a/changes_for_pharo.st +++ b/changes_for_pharo.st @@ -18,8 +18,8 @@ TimerScheduler extend [ reinitialize [ - loop terminate. - self startLoop. + "(Delay forSeconds: 1) wait can get stuck in Pharo for-ever.. Change the approach" + lastDelay ifNotNil: [lastDelay signalWaitingProcess] ] ]