ui.backend.cocoa: fix reset of thread-timer.

db4
John Benediktsson 2015-01-17 15:58:57 -08:00
parent a85543a42f
commit 3f3c11c446
3 changed files with 8 additions and 5 deletions

View 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>

View 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 ;

View 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 ;