 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

    ] change-timers drop ;

SYMBOL: thread-timer

: (reset-thread-timer) ( timer -- )
    sleep-time

    >CFAbsoluteTime CFRunLoopTimerSetNextFireDate ;

: reset-thread-timer ( -- )
    thread-timer get-global [ (reset-thread-timer) ] when* ;

: thread-timer-callback ( -- callback )
    [ drop (reset-thread-timer) yield ] CFRunLoopTimerCallBack ;
