X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=gtk%2Fgtk.main_loop_events.lisp;h=d2809bca826cb6317e96493eb6c4d2907e447b9c;hb=2d52efb9e6f8bde7e5a99a8d21741c81ee71bd7d;hp=ecdb3dadc4a37159257efc61cb72d2c21c9dc0be;hpb=63fbed86c67daf990991d31d7f6f0c90fa9cb499;p=cl-gtk2.git diff --git a/gtk/gtk.main_loop_events.lisp b/gtk/gtk.main_loop_events.lisp index ecdb3da..d2809bc 100644 --- a/gtk/gtk.main_loop_events.lisp +++ b/gtk/gtk.main_loop_events.lisp @@ -19,18 +19,25 @@ (gtk-init) -(defcfun gtk-test-register-all-types :void) +(defcfun gtk-main :void) -(gtk-test-register-all-types) +#+thread-support +(defvar *main-thread* nil) -(defcfun gtk-events-pending :boolean) +#+thread-support +(defun ensure-gtk-main () + (when (and *main-thread* (not (bt:thread-alive-p *main-thread*))) + (setf *main-thread* nil)) + (unless *main-thread* + (setf *main-thread* (bt:make-thread (lambda () (gtk:gtk-main)) :name "cl-gtk2 main thread")))) -(defcfun gtk-main :void) +#+thread-support +(defun join-main-thread () + (when *main-thread* + (bt:join-thread *main-thread*))) #+thread-support -(defun ensure-gtk-main () - (unless (find "gtk main thread" (bt:all-threads) :test 'string= :key 'bt:thread-name) - (bt:make-thread (lambda () (gtk:gtk-main)) :name "gtk main thread"))) +(export 'join-main-thread) #-thread-support (defun ensure-gtk-main ()