forked from dmitryvk/cl-gtk2
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgdk.threads.lisp
73 lines (57 loc) · 2.34 KB
/
gdk.threads.lisp
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
(in-package :gdk)
(defcfun gdk-threads-init :void)
(glib:at-init () (gdk-threads-init))
(defcfun gdk-threads-enter :void)
(export 'gdk-threads-enter)
(defcfun gdk-threads-leave :void)
(export 'gdk-threads-leave)
(defmacro with-gdk-threads-lock (&body body)
`(progn
(gdk-threads-enter)
(unwind-protect
(progn ,@body)
(gdk-threads-leave))))
(export 'with-gdk-threads-lock)
;; ignored:
;; void gdk_threads_set_lock_functions (GCallback enter_fn,
;; GCallback leave_fn);
(defcallback source-func-callback :boolean
((data :pointer))
(funcall (stable-pointer-value data)))
(defcallback stable-pointer-free-destroy-notify-callback :void ((data :pointer))
(free-stable-pointer data))
(defcfun gdk_threads_add_idle_full :uint
(priority :int)
(function :pointer)
(data :pointer)
(destroy-notify :pointer))
(defun gdk-threads-add-idle-full (priority function)
(gdk_threads_add_idle_full priority
(callback source-func-callback)
(allocate-stable-pointer function)
(callback stable-pointer-free-destroy-notify-callback)))
(export 'gdk-threads-add-idle-full)
(defcfun gdk_threads_add_timeout_full :uint
(priority :int)
(interval :uint)
(function :pointer)
(data :pointer)
(destroy-notify :pointer))
(defun gdk-threads-add-timeout-full (priority interval-msec function)
(gdk_threads_add_timeout_full priority interval-msec
(callback source-func-callback)
(allocate-stable-pointer function)
(callback stable-pointer-free-destroy-notify-callback)))
(export 'gdk-threads-add-timeout-full)
(defcfun gdk_threads_add_timeout_seconds_full :uint
(priority :int)
(interval :uint)
(function :pointer)
(data :pointer)
(destroy-notify :pointer))
(defun gdk-threads-add-timeout-seconds-full (priority interval-sec function)
(gdk_threads_add_timeout_seconds_full priority interval-sec
(callback source-func-callback)
(allocate-stable-pointer function)
(callback stable-pointer-free-destroy-notify-callback)))
(export 'gdk-threads-add-timeout-seconds-full)