delay: Try to make it work better on Pharo
Do not attempt to terminate a process, just signal the lastDelay to kick the queue again.
This commit is contained in:
parent
a8e8ee1847
commit
3e2be093de
8
Timer.st
8
Timer.st
|
@ -67,7 +67,7 @@ Object subclass: Timer [
|
|||
]
|
||||
|
||||
Object subclass: TimerScheduler [
|
||||
| queue sem loop quit |
|
||||
| queue sem loop quit lastDelay |
|
||||
<category: 'OsmoCore-Timer'>
|
||||
<comment: 'I can help to fire things at the right time. Right now I
|
||||
only work on seconds granularity because Time has no direct access to
|
||||
|
@ -136,7 +136,11 @@ bit difficult to do this race free.'>
|
|||
|
||||
[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].
|
||||
]
|
||||
|
|
|
@ -18,8 +18,8 @@ TimerScheduler extend [
|
|||
|
||||
reinitialize [
|
||||
<category: 'creation'>
|
||||
loop terminate.
|
||||
self startLoop.
|
||||
"(Delay forSeconds: 1) wait can get stuck in Pharo for-ever.. Change the approach"
|
||||
lastDelay ifNotNil: [lastDelay signalWaitingProcess]
|
||||
]
|
||||
]
|
||||
|
||||
|
|
Reference in New Issue