Re: How to handle long I/O operations




I think you havent got it yet:
gtk_idle_add() starts the calculation once, and then your app is blocked
until you leave the clac function. smae with gtk_timeout_add().
if you would like to use gtk_idle_add() then you had to split the
calculation into parts (maybe doing 10 loops saving the position in the
calculation) and then return to gtk.

If you cannot split this calculation for some reason, then i cant see
another solution than the gtk_main_iteration(), if you dont want to use
threads or fork().

Markus.

Hy,

Yes I've got it, that's why I was saying thanks to Taura for her warning
about gtk_main_iteration(). So now I will use it in the calculation
algorithm, and before starting this calculation I'll take a semaphore (you
know this P and V function really usefull to access ressource when dealing
with forks - as I'm not sure of the english word, I hope you understand) to
lock the rest of the UI (or maybe some part only...) and release it once
finished. So I'm just going to build a Macro that will call
gtk_main_iteration() time to time while calculating (and in non heavy calcul
sensitive loop to avoid overhead).
Thanks for your help, it has been really clear and usefull :-)

PS: if I still didn't get it, just tell me :-) but I hope I got it ;-)

Jean-Christophe






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