Re: Threads, gtk, pthreads, and gthreads



Gonzalo Aguilar <GAguilarDelgado terra es> writes:

Should I switch to gtk2 or should I wait?

I'd suggest switching to gtk2. It is much better than gtk1.

What about having 10-30 threads working for the main process in a gtk
app? 
I know about 255 threads limit (pthreads) but with 10-30 GUI will be
slow, I think.

What do you need the threads for? 

If you want to do some background processing and have your GUI update
at the same time, it is almost always better to g_idle_add() a
function to do the processing and then in that function do

        while (gtk_event_pending())
                gtk_main_iteration (FALSE);

to allow events to be processed.

Alternatively, if you really need to update the GUI from a thread, do
g_idle_add (function_that_does_the_updating, ...). In this case,
"function_that_does_the_updating" will be called from the thread that
runs the main loop, so it can safely call gtk functions.



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