Re: Instabilities with multi threaded application



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),
*then* use gdk_threads_enter/leave around gtk+ calls in either thread.

Note that you can use a GAsyncQueue if it strikes you as an elegent
solution and if you wish to avoid sleeping in your worker thread
then you can consider using a GCondition (i.e. g_cond_signal/g_cond_wait).

Cheers,
                                    -Tristan





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