]> gitweb.factorcode.org Git - factor.git/blob - basis/core-foundation/timers/timers.factor
Merge branch 'master' into experimental (untested!)
[factor.git] / basis / core-foundation / timers / timers.factor
1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien.syntax system math kernel core-foundation ;
4 IN: core-foundation.timers
5
6 TYPEDEF: void* CFRunLoopTimerRef
7 TYPEDEF: void* CFRunLoopTimerCallBack
8 TYPEDEF: void* CFRunLoopTimerContext
9
10 FUNCTION: CFRunLoopTimerRef CFRunLoopTimerCreate (
11    CFAllocatorRef allocator,
12    CFAbsoluteTime fireDate,
13    CFTimeInterval interval,
14    CFOptionFlags flags,
15    CFIndex order,
16    CFRunLoopTimerCallBack callout,
17    CFRunLoopTimerContext* context
18 ) ;
19
20 : <CFTimer> ( callback -- timer )
21     [ f millis 1000 /f 60 0 0 ] dip f CFRunLoopTimerCreate ;
22
23 FUNCTION: void CFRunLoopTimerInvalidate (
24    CFRunLoopTimerRef timer
25 ) ;
26
27 FUNCTION: void CFRunLoopTimerSetNextFireDate (
28    CFRunLoopTimerRef timer,
29    CFAbsoluteTime fireDate
30 ) ;