Re: Instabilities with multi threaded application



On Fri, 2004-07-23 at 10:39 -0400, Tristan Van Berkom wrote:
> Philip Van Hoof wrote:
> [...]
> 
>      "Unexpected async reply" means that the X server sent you
> something your app was not prepared for, most often this means
> that your thread has no associated GMainContext or is shareing the
> same context as the parent thread (um, err, Its a little early after
> a long night of gin so bear with me). Make sure you are calling
> gdk_threads_init(); at the beginning of your program, and make


> sure you use the gthread api (wich will use pthreads under linux),


I thank you, Tristan

I was unaware of a gthread API and was indeed using pthreads directly. I
have ported all phtread functions to the gthread API and now things are
actually stable and working.

I am actually pretty amazed about this. The same code ran buggy as hell
a few minutes ago, now it's as stable as I expected it to be.

By that I mean that it works :)

I must say, however, that most of the older mailinglist posts and Gtk+
(> 2.0) documentation are very silent about the existence of this
pthread API in glib. 

My humble opinion is that we (or the documentation writers) should put
an extra focus on this pthread API in the documentation and even more,
the examples. 

Maybe this is old documentation, but it's coming as first one when you
do a search on google: "multi thread gtk+"

http://lidn.sourceforge.net/books/gtk-faq-2.0.6/book/x462.html

The x462.html should clearly explain how to use the gthread API. I am
willing to modify the sample if I am sure that the documentation will
indeed get published on gnome (I dislike loosing time on getting stuff
approved). 

It's a sample that shows how to use the pthread API. It's not mentioning
the gthread API. It would have saved me a few hours useless debugging if
a better, more modern, sample would have come first on google.

Nevertheless, thanks a lot. You saved my weekend. Really :). I can
imagine myself debugging and coding all weekend long just to get this
threading stuff right. Now my girlfriend will probably have her
programmer all for herself in stead of behind his company laptop. Haha



-- 
Philip Van Hoof, Software Developer @ Cronos
home: me at freax dot org
gnome: pvanhoof at gnome dot org
work: Philip dot VanHoof at Cronos dot Be
http://www.freax.be, http://www.freax.eu.org




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