core-foundation.run-loop: make sure to reset when switching between UI and NO_UI.
parent
3f3c11c446
commit
208f01416d
|
@ -3,7 +3,7 @@
|
||||||
USING: accessors alien alien.c-types alien.syntax
|
USING: accessors alien alien.c-types alien.syntax
|
||||||
core-foundation core-foundation.file-descriptors
|
core-foundation core-foundation.file-descriptors
|
||||||
core-foundation.strings core-foundation.time
|
core-foundation.strings core-foundation.time
|
||||||
core-foundation.timers destructors kernel math namespaces
|
core-foundation.timers destructors init kernel math namespaces
|
||||||
sequences threads ;
|
sequences threads ;
|
||||||
FROM: calendar.unix => system-micros ;
|
FROM: calendar.unix => system-micros ;
|
||||||
IN: core-foundation.run-loop
|
IN: core-foundation.run-loop
|
||||||
|
@ -102,6 +102,8 @@ SYMBOL: run-loop
|
||||||
] change-timers drop ;
|
] change-timers drop ;
|
||||||
|
|
||||||
SYMBOL: thread-timer
|
SYMBOL: thread-timer
|
||||||
|
[ f thread-timer set-global ]
|
||||||
|
"core-foundation.run-loop" add-startup-hook
|
||||||
|
|
||||||
: (reset-thread-timer) ( timer -- )
|
: (reset-thread-timer) ( timer -- )
|
||||||
sleep-time
|
sleep-time
|
||||||
|
@ -109,7 +111,7 @@ SYMBOL: thread-timer
|
||||||
>CFAbsoluteTime CFRunLoopTimerSetNextFireDate ;
|
>CFAbsoluteTime CFRunLoopTimerSetNextFireDate ;
|
||||||
|
|
||||||
: reset-thread-timer ( -- )
|
: reset-thread-timer ( -- )
|
||||||
thread-timer get-global (reset-thread-timer) ;
|
thread-timer get-global [ (reset-thread-timer) ] when* ;
|
||||||
|
|
||||||
: thread-timer-callback ( -- callback )
|
: thread-timer-callback ( -- callback )
|
||||||
[ drop (reset-thread-timer) yield ] CFRunLoopTimerCallBack ;
|
[ drop (reset-thread-timer) yield ] CFRunLoopTimerCallBack ;
|
||||||
|
|
Loading…
Reference in New Issue