700 milliseconds sleep dup restart-timer
700 milliseconds sleep stop-timer 500 milliseconds sleep
] 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
] if ;
: restart-timer ( timer -- )
- t >>restart?
dup quotation-running?>> [
- drop
+ t >>restart? drop
] [
- dup thread>> [ nip interrupt ] [ start-timer ] if*
+ dup thread>> [ interrupt ] when* start-timer
] if ;
<PRIVATE