Re: Event loop



I think you mean threads not another process...

Threads are a much better solution than creating another process...


G Hasse <gh raditex se> writes:

On Fri, 10 Nov 2000, Ubirata Azevedo Ignacio wrote:


  Hi!

  How can I control th event loop?
  I wanna something like
 
     while(1)
     {
do_something() ;
process_gtk_event_loop() ;
do_another_thing() ;
     }

Is this just not bad Unix programming? Why not devide your program in
several processes and let them communicate? Use file descriptors or
sockets to do the communication.

If you want to do several thing in one process - you must have
made a bad design... Well some small things might go inte a single
process - but if you devide our system in several processes you should
get rid of the above construct.

process_gtk_event_loop should be:
while (gtk_events_pending ())
        gtk_main_iteration ();

However, it depends what do_something and do_another_thing are doing.
If you are doing anything that is fairly computationally intensive, then
doing it in a separate process is probably the cleanest way to do so.
This will give you a much nicer GUI, as a result.

If you are just doing something occasionally, you may be able to do it
in an idle handler.  More info on this is available at:

http://developer.gnome.org/doc/API/gtk/gtk-general.html#GTK-TIMEOUT-ADD

Thanks,
-Jonathan

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com





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