From 246031be275ccb404e6344461f516a874ba88341 Mon Sep 17 00:00:00 2001 From: Dmitry Kalyanov Date: Wed, 13 May 2009 15:18:59 +0400 Subject: [PATCH] Use global variable to reference main loop instead of thread name --- gtk/gtk.main_loop_events.lisp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 () -- 1.7.10.4