core-foundation.run-loop: make sure to reset when switching between UI and NO_UI.

db4
John Benediktsson 2015-01-17 16:40:21 -08:00
parent 3f3c11c446
commit 208f01416d
1 changed files with 4 additions and 2 deletions

View File

@ -3,7 +3,7 @@
USING: accessors alien alien.c-types alien.syntax
core-foundation core-foundation.file-descriptors
core-foundation.strings core-foundation.time
core-foundation.timers destructors kernel math namespaces
core-foundation.timers destructors init kernel math namespaces
sequences threads ;
FROM: calendar.unix => system-micros ;
IN: core-foundation.run-loop
@ -102,6 +102,8 @@ SYMBOL: run-loop
] change-timers drop ;
SYMBOL: thread-timer
[ f thread-timer set-global ]
"core-foundation.run-loop" add-startup-hook
: (reset-thread-timer) ( timer -- )
sleep-time
@ -109,7 +111,7 @@ SYMBOL: thread-timer
>CFAbsoluteTime CFRunLoopTimerSetNextFireDate ;
: reset-thread-timer ( -- )
thread-timer get-global (reset-thread-timer) ;
thread-timer get-global [ (reset-thread-timer) ] when* ;
: thread-timer-callback ( -- callback )
[ drop (reset-thread-timer) yield ] CFRunLoopTimerCallBack ;