]> gitweb.factorcode.org Git - factor.git/blob - basis/core-foundation/timers/timers.factor
factor: trim more using lists.
[factor.git] / basis / core-foundation / timers / timers.factor
1 ! Copyright (C) 2008, 2010 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien.c-types alien.syntax calendar.unix core-foundation
4 core-foundation.time ;
5 IN: core-foundation.timers
6
7 TYPEDEF: void* CFRunLoopTimerRef
8
9 CALLBACK: void CFRunLoopTimerCallBack (
10    CFRunLoopTimerRef timer,
11    void *info
12 )
13
14 TYPEDEF: void* CFRunLoopTimerContext
15
16 FUNCTION: CFRunLoopTimerRef CFRunLoopTimerCreate (
17    CFAllocatorRef allocator,
18    CFAbsoluteTime fireDate,
19    CFTimeInterval interval,
20    CFOptionFlags flags,
21    CFIndex order,
22    CFRunLoopTimerCallBack callout,
23    CFRunLoopTimerContext* context
24 )
25
26 :: <CFTimer> ( interval callback -- timer )
27     f system-micros >CFAbsoluteTime interval 0 0 callback f
28     CFRunLoopTimerCreate ;
29
30 FUNCTION: void CFRunLoopTimerInvalidate (
31    CFRunLoopTimerRef timer
32 )
33
34 FUNCTION: Boolean CFRunLoopTimerIsValid (
35    CFRunLoopTimerRef timer
36 )
37
38 FUNCTION: void CFRunLoopTimerSetNextFireDate (
39    CFRunLoopTimerRef timer,
40    CFAbsoluteTime fireDate
41 )
42
43 FUNCTION: Boolean CFRunLoopTimerDoesRepeat (
44    CFRunLoopTimerRef timer
45 )
46
47 FUNCTION: CFTimeInterval CFRunLoopTimerGetInterval (
48    CFRunLoopTimerRef timer
49 )
50
51 FUNCTION: CFAbsoluteTime CFRunLoopTimerGetNextFireDate (
52    CFRunLoopTimerRef timer
53 )