X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=gtk%2Fgtk.main_loop_events.lisp;h=961b357f5334e11ea31a12778f79a042a7192cf3;hb=280cc197440f3dec31bcbcd88b001b740be6e697;hp=5fbc15fbe3959235440078524628fc92000f14fc;hpb=30e44c3f887afcf3ef37c74d09f4abea815d2276;p=cl-gtk2.git diff --git a/gtk/gtk.main_loop_events.lisp b/gtk/gtk.main_loop_events.lisp index 5fbc15f..961b357 100644 --- a/gtk/gtk.main_loop_events.lisp +++ b/gtk/gtk.main_loop_events.lisp @@ -17,9 +17,7 @@ (error "Cannot initialize Gtk+")) (foreign-free (mem-ref argv '(:pointer :string)))))) -(gtk-init) - -(defcfun gtk-events-pending :boolean) +(at-init () (gtk-init)) (defcfun gtk-main :void) @@ -27,11 +25,17 @@ (defvar *main-thread* nil) #+thread-support +(at-finalize () + (when (and *main-thread* (bt:thread-alive-p *main-thread*)) + (bt:destroy-thread *main-thread*) + (setf *main-thread* nil))) + +#+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")))) + (setf *main-thread* (bt:make-thread (lambda () (gtk-main)) :name "cl-gtk2 main thread")))) #+thread-support (defun join-main-thread ()