-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David Ne?as (Yeti) wrote:
> On Sat, Aug 04, 2007 at 09:38:25PM +0800, Gregory Hosler wrote:
>> I have a threaded gtk application. The threads create some gui (gtk
>> widgets/windows). and most of the time (maybe 80%) everything works as 
>> expected.
>> Occassionally I will get the message on stdout
>>
>>      Xlib: unexpected async reply (sequence #####)!
>>
>> the ### is an x event sequence number
>>
>> I am suspecting that this is because of the x calls from 2 different threads.
>>
>> Is this a known problem?
>>
>> Any way around this ? (I thought gtk was supposed to be thread ok :)
> 
> The answer depends on your defintions of `OK', `known' and
> `problem':
> - Gtk+ is thread-aware
> - Gtk+ is not thread-safe
> 
> If you operate on the GUI from multiple threads:
> - you are responsible for the locking on Unix/X
> - it will just not work on MS Windows
> 
> See
> 
>   http://developer.gnome.org/doc/API/2.0/gdk/gdk-Threads.html

That threads_enter/threads_leave doesn't look so bad, since I'm not doing alot
of gtk withing my thread. Looks like it might be the way to go for me.

thanks for the pointer!

- -G

> People typically operate on the GUI only from the main
> thread (i.e. running gtk_main()) and pass work requests to
> it via g_idle_add() or some other queue mechanism.
> 
> This topic is discussed here every other week, see the list
> archives.
> 
> Yeti
> 
> --
> http://gwyddion.net/
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


- --
+---------------------------------------------------------------------+

Please also check the log file at "/dev/null" for additional information.
                (from /var/log/Xorg.setup.log)

| Greg Hosler                                   [EMAIL PROTECTED]    |
+---------------------------------------------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFGtIgy404fl/0CV/QRAjb8AKDcG5q92/8nh9/AzPUfO/gFc1I01ACfWq9i
X2oqg4dOP2r8i/yCjCz+nOc=
=IQs8
-----END PGP SIGNATURE-----
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to