Re: using threads with GTK+



I'm going to use the following threads with GTK+:
  - thread 1 does all GUI job (widgets etc.) and launches more threads
    when needed;
  - threads 2, ... (launched by 1) do some time consuming computations
    and inform thread 1 once they are done so it can present the results
    to user.

The only thing i'm not sure how to implement is how to let thread 1 know
when one of working threads is finished.  Current best way i found while
studying GTK+ and Glib manuals is like this:

It's a good idea.

Another simple option may be a "single list" (queue?) as a common object / 
variable. I mean... every thread can "add_finish(my_id)" to the list, and 
thread 1 can "take_finished()" from this list. Note that this acces should 
be in mutex.

Maybe it's not the best option, but it's safe ^_^  and it's (I think) like 
the async queue...

See you.

.-:Namarie:-.



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