Re: Multi-threaded GTK+



At 13:01 06.11.01 +0200, Tor Lillqvist wrote:
>It seems that trying to use GTK+ in a multi-threaded application on
>Win32 opens up a can of worms, that has until now been largely ignored
>(by me, at least). (Bug #60620 is one example. I put in a tentative
>hack that seems to fix the immediate problem in the test case attached
>to the bug report, but I am sure that in the general case there are
>still lots of problems.)
>
>How well is multi-threaded GTK+ supposed to work? Are there real
>applications (that might otherwise be useful and portable to Win32)
Balsa (mail client) : http://www.newton.cx/balsa/
Pavuk (web site cloning) : http://www.idata.sk/~ondrej/pavuk/about.html
gftp (ftp client) : http://gftp.seul.org/

>that do GDK operations on the same windows from different threads?
Maybe a simple:

  GDK_THREADS_ENTER ();
  real_window_procedure(...);
  GDK_THREADS_LEAVE ();

in _gdk_win32_window_procedure() would help a lot ?
And using PostMessage() instead of SendMessage() where ever possible.
 
>Would it be a big drawback if, for instance, we would document that in
>multi-threaded GTK+ programs expected to run on Win32, all GTK+ calls
>should be made in one thread (using gtk_idle_add() or similar if
>necessary).
>
IMO it depends on the use in real threaded Gtk+ apps ...

> [...]
>
>But Windows knows the thread that created each window, and some
>operations on a window from another thread might cause lots of fun
>like deadlocks unless the application programmer is very careful with
>what the window owning thread might be doing at the time another
>thread tries to operate on the window. Do a Google newsgroup search on
>"win32 thread window deadlock".
>
Yeah, funny things also involving MsgWaitForMultipleObjects ().

	Hans

-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to 
get along without it.                -- Dilbert



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]