]> gitweb.factorcode.org Git - factor.git/commitdiff
ui.backend.cocoa: fix reset of thread-timer.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sat, 17 Jan 2015 23:58:57 +0000 (15:58 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sat, 17 Jan 2015 23:58:57 +0000 (15:58 -0800)
basis/core-foundation/run-loop/run-loop.factor
basis/io/backend/unix/multiplexers/run-loop/run-loop.factor
basis/ui/backend/cocoa/cocoa.factor

index dcd815fdd4c9038b3c8a545fa1017df5d0566fe3..5066f13c5e1f142103d822f0ee49406ade75853f 100644 (file)
@@ -103,13 +103,16 @@ SYMBOL: run-loop
 
 SYMBOL: thread-timer
 
-: reset-thread-timer ( timer -- )
+: (reset-thread-timer) ( timer -- )
     sleep-time
     [ 1000 /f ] [ 1,000,000 ] if* system-micros +
     >CFAbsoluteTime CFRunLoopTimerSetNextFireDate ;
 
+: reset-thread-timer ( -- )
+    thread-timer get-global (reset-thread-timer) ;
+
 : thread-timer-callback ( -- callback )
-    [ drop reset-thread-timer yield ] CFRunLoopTimerCallBack ;
+    [ drop (reset-thread-timer) yield ] CFRunLoopTimerCallBack ;
 
 : init-thread-timer ( -- )
     60 thread-timer-callback <CFTimer>
index 007d3c67625decdac56f2d776b7d831ec5214934..8ee5c9fb74edcc6a996af910dafa13056049d4ca 100644 (file)
@@ -14,7 +14,7 @@ TUPLE: run-loop-mx kqueue-mx ;
         2drop
         0 mx get-global kqueue-mx>> wait-for-events
         enable-all-callbacks
-        thread-timer get-global reset-thread-timer
+        reset-thread-timer
         yield
     ] CFFileDescriptorCallBack ;
 
index 9674a728926687918e8f159dcb19f058609f2fb3..56f2ce77ac9a06b4154c99813b0965632049d5b0 100644 (file)
@@ -234,7 +234,7 @@ M: cocoa-ui-backend system-alert
 CLASS: FactorApplicationDelegate < NSObject
 [
     METHOD: void applicationDidUpdate: id obj
-    [ reset-run-loop ]
+    [ reset-thread-timer ]
 ]
 
 : install-app-delegate ( -- )
@@ -254,7 +254,7 @@ M: cocoa-ui-backend (with-ui)
             start-ui
             stop-io-thread
             init-thread-timer
-            reset-run-loop
+            reset-thread-timer
             NSApp -> run
         ] ui-running
     ] with-cocoa ;