]> gitweb.factorcode.org Git - factor.git/commitdiff
core-foundation.run-loop: make sure to reset when switching between UI and NO_UI.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sun, 18 Jan 2015 00:40:21 +0000 (16:40 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 18 Jan 2015 00:40:21 +0000 (16:40 -0800)
basis/core-foundation/run-loop/run-loop.factor

index 5066f13c5e1f142103d822f0ee49406ade75853f..541b8e011f816f5f918efbbfbc833e43d95a42ed 100644 (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 ;