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

Re: Window not updating from within thread



Dave Andruczyk wrote:

>I have an application in gtk-1.2 (eXtace) which previously had used a
>gtk_input() function to gather incoming data, at the end of each iteration of
>that function it would modify some parts fo a drawing area, (updated a moving
>marker to represent how much data arrived).  Since converting this from a
>gtk_input to a plain pthread (posix thread) doingthe same gui updates (wrapped,
>inside gtk_threads_enter/leave() calls) it no longer updates the window of
>interest when it is called.  It WILL update when a seperate gtk_timeout_func()
>runs, and updates at the rate of that timeout.  The timeout is called to update
>other drawing areas at a periodic rate, andhte input and timeouts are not
>synchronous (they are independant)  Previously when NOT using the pthread, the
>input funciton would update the window INDEPENTANTLY of the timeout function, 
>Now with the pthread the behavior calls to update the smaller drawing area (in
>the input function) now ony update the screen when the main timeout gets
>called...
>
>The gui calls in both the pthread input function and the gtk_input function are
>identical, with the exception that the pthread ones are wrapped in
>gtk_threads_enter/leave, since it runs outside of the main gtk loop.
>
>Any ideas??
>  
>
Hmmm,
    What is different in a parent thread and a child thread...
- A parent thread comes with a GMainContext ? (no, not nescisarily)
hmmm, cant think of much... (anyway the GMainLoop releases the
gdk_threads_mutex when itterating through GSources, i.e. running
your code).

Why would you only protect shared gtk objects from simultanious
accesses in the child thread (the one spawned with g_thread_create()) ?

If that doesn't solve your problem; you might consider posting a
short example of "what isn't working"; sometimes a line of
code is worth a thousand words ;-)


Regards,
                                            -Tristan






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