ui.backend.cocoa: fix reset of thread-timer.
parent
a85543a42f
commit
3f3c11c446
|
@ -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>
|
||||
|
|
|
@ -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 ;
|
||||
|
||||
|
|
|
@ -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 ;
|
||||
|
|
Loading…
Reference in New Issue