Re: Creating threads within widget draw routines ..



On Thu, Nov 21, 2002 at 09:30:42AM -0500, Paul Davis wrote:
> >thread wake up and draw the updates. A simple way to wake up the main
> >thread is to just gtk_widget_queue_draw() on the display area from the
> >secondary thread, or just add a one-shot idle function yourself to the
> >main GMainContext. Or something along those lines, I haven't written a
> >threaded app myself.
> 
> last time i looked, neither of these functions are thread-safe, and so
> the caller must still use explicit locking around calls to them.
> 

You have to lock to queue draw, but then the actual drawing happens in
the main thread, and the queue_draw should result in installing an
idle handler which should result in waking up the main thread if the
main thread was blocking.

g_idle_add() is intended to be thread safe I believe. (It locks the
GMainContext for you.)

Havoc



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