timers: fix issue with restart-timer after timer went off.
parent
91e55dc02a
commit
a27f560475
|
@ -64,3 +64,12 @@ threads tools.test tools.time ;
|
||||||
700 milliseconds sleep dup restart-timer
|
700 milliseconds sleep dup restart-timer
|
||||||
700 milliseconds sleep stop-timer 500 milliseconds sleep
|
700 milliseconds sleep stop-timer 500 milliseconds sleep
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
{ { 2 } } [
|
||||||
|
{ 0 }
|
||||||
|
dup '[ 0 _ [ 1 + ] change-nth ] 300 milliseconds f <timer>
|
||||||
|
dup restart-timer
|
||||||
|
700 milliseconds sleep
|
||||||
|
dup restart-timer drop
|
||||||
|
700 milliseconds sleep
|
||||||
|
] unit-test
|
||||||
|
|
|
@ -94,11 +94,10 @@ PRIVATE>
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
: restart-timer ( timer -- )
|
: restart-timer ( timer -- )
|
||||||
t >>restart?
|
|
||||||
dup quotation-running?>> [
|
dup quotation-running?>> [
|
||||||
drop
|
t >>restart? drop
|
||||||
] [
|
] [
|
||||||
dup thread>> [ nip interrupt ] [ start-timer ] if*
|
dup thread>> [ interrupt ] when* start-timer
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
Loading…
Reference in New Issue