[java-gnome-hackers] threads
Brought to you by:
afcowie
From: Mark H. <mh...@ca...> - 2003-02-21 13:13:32
|
Hi, I've been looking again at the gtk code. I'm not sure if this is new for gtk 2.2 - I'm sure it wasn't there when I looked last year. Apparently, Gtk methods can be called from multiple threads, if all are enclosed within gdk_threads_enter()/ gdk_threads_leave() statements (with a gtk_flush() before the leave()).g_thread_init() and gdk_threads_init() must also be called from each thread. Unfortunately I don't have enough time at the moment to look at this in more detail. I'm not sure whether the enter/leave calls have to be made if the code is running in the main thread - If they don't, then we could make modifications easily to allow multiple threads. If they do, then this may simply mean that the user has to make calls to enter/leave before modifying the gui. Most callbacks are done in the graphics thread. I am also confused by the examples having: gdk_threads_enter (); gtk_main (); gdk_threads_leave (); wouldn't this block any other threads acquiring the lock? Relevant web pages are: http://developer.gnome.org/doc/API/2.0/gtk/gtk-question-index.html#id2848858 http://developer.gnome.org/doc/API/2.0/gdk/gdk-Threads.html -- .''`. Mark Howard : :' : `. `' http://www.tildemh.com `- mh...@de... | mh...@ti... | mh...@ca... |