To: sacerdot at CS.UniBO.IT Cc: lablgtk at kaba.or.jp Subject: Re: GToolbox not thread safe? In-Reply-To: <20030121191938.A1749 at cs.unibo.it> References: <20030121191938.A1749 at cs.unibo.it> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20030122091052U.garrigue at kurims.kyoto-u.ac.jp> Date: Wed, 22 Jan 2003 09:10:52 +0900 From: Jacques Garrigue Lines: 24 From: Claudio Sacerdoti Coen > I have to face the usual problem of combining threads and modal windows. > Since the code of GMain.Main.main is not thread-aware (it never calls > Thread.delay), I suppose that the right thing to do is using the (odd) pair > of functions GtkThread.main () / GMain.Main.quit (). I checked the code > and they share the GMain.Main.loops; thus everything should work fine. That's right > Am I doing something reasonable? If the answer is yes, I deduce that the > code in GToolbox is not thread-safe (since it uses GMain.Main.main ()). > Otherwise I deduce that GMain.Main.main () for nested Gtk loops works fine. > But I can't understand why (and a quick test showed me exactly the > opposite). Right again. I suppose that the right thing to do would be to make GMain.main a stub, and update it to call GtkThread.main the first time GtkThread.main is called. Yet, I always have the feeling that this stack of loops is not "right". The Tk way to wait for a condition variable seems more correct. But well, this is the Gtk way I suppose. Jacques