Re: [gtk-list] gtk and threads



> 
> 
> Has anyone used gtk clist with threads?
> 
> It appears to me that gtk doesn't like to be messed with from two (or more
> threads).
> 

While I haven't used clist, I am writing a threaded program which uses gtk.
And you're right, you can't call gtk functions from the other thread.  What
I did was to set up queues, protected by mutexes, to send data from oine
thread to another.  The the gtk thread runs in a loop, first checking the
queue and taking any appropriate actions, then calling a function like

while (gtk_events_pending())
   gtk_main_iteration();

to update the screen.  This has given me fairly good results, and my crashes
aren't due to this, but to all of my other mistakes.

katre



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