From: Dmitry Kalyanov Date: Wed, 13 May 2009 11:18:59 +0000 (+0400) Subject: Use global variable to reference main loop instead of thread name X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=246031be275ccb404e6344461f516a874ba88341;p=cl-gtk2.git Use global variable to reference main loop instead of thread name --- diff --git a/gtk/gtk.main_loop_events.lisp b/gtk/gtk.main_loop_events.lisp index ecdb3da..d2bdb9c 100644 --- a/gtk/gtk.main_loop_events.lisp +++ b/gtk/gtk.main_loop_events.lisp @@ -28,9 +28,17 @@ (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"))) + (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 (defun ensure-gtk-main ()