-
Notifications
You must be signed in to change notification settings - Fork 3
/
idle-wrapper.dylan
51 lines (42 loc) · 1.31 KB
/
idle-wrapper.dylan
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
module: uv
author: Bruce Mitchener <[email protected]>
copyright: MIT
define C-subtype <%uv-idle> (<%uv-handle>) end;
define class <uv-idle> (<uv-handle>) end;
define inline C-function %uv-idle-init
parameter loop :: <uv-loop>;
parameter idle :: <%uv-idle>;
result xxx :: <C-int>;
c-name: "uv_idle_init";
end;
define inline C-function %uv-idle-start
parameter idle :: <%uv-idle>;
parameter callback :: <C-function-pointer>;
result xxx :: <C-int>;
c-name: "uv_idle_start";
end;
define inline C-function %uv-idle-stop
parameter idle :: <%uv-idle>;
result xxx :: <C-int>;
c-name: "uv_idle_stop";
end;
define inline function uv-idle-start
(idle :: <uv-idle>, callback :: <function>)
=> (result :: <integer>)
idle.callback := callback;
%uv-idle-start(idle.raw-handle, %invoke-callback)
end;
define inline function uv-idle-stop (idle :: <uv-idle>) => (_)
%uv-idle-stop(idle.raw-handle)
end;
define inline C-function %uv-dylan-idle-new
result idle :: <%uv-idle>;
c-name: "uv_dylan_idle_new";
end;
define sealed domain make (singleton(<uv-idle>));
define sealed domain initialize (singleton(<uv-idle>));
define sealed method initialize (idle :: <uv-idle>, #key loop = uv-default-loop())
idle.raw-handle := %uv-dylan-idle-new();
next-method();
%uv-idle-init(loop, idle.raw-handle);
end;