X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=gtk%2Fgtk.main_loop_events.lisp;h=5fbc15fbe3959235440078524628fc92000f14fc;hb=08412ba48592934cf6f7e822cd02818373357c30;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..5fbc15f 100644 --- a/gtk/gtk.main_loop_events.lisp +++ b/gtk/gtk.main_loop_events.lisp @@ -19,18 +19,27 @@ (gtk-init) -(defcfun gtk-test-register-all-types :void) - -(gtk-test-register-all-types) - (defcfun gtk-events-pending :boolean) (defcfun gtk-main :void) #+thread-support +(defvar *main-thread* nil) + +#+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"))) + (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")))) + +#+thread-support +(defun join-main-thread () + (when *main-thread* + (bt:join-thread *main-thread*))) + +#+thread-support +(export 'join-main-thread) #-thread-support (defun ensure-gtk-main ()