smalltalk
/
osmo-st-core
Archived
1
0
Fork 0

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:
Holger Hans Peter Freyther 2013-10-07 11:48:44 +02:00
parent a8e8ee1847
commit 3e2be093de
2 changed files with 8 additions and 4 deletions

View File

@ -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].
]

View File

@ -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]
]
]