[gtkada] GtkAda and tasking

Emmanuel Briot briot at gnat.com
Thu Apr 20 11:05:48 CEST 2000


 > No. That's exactly what I want to avoid. Because, when I'm not processing
 > events, I'll need a select to accept communications from other tasks, and if
 > I stay blocked at the select, events won't be processed any more. Of course
 > I could add an "or delay" to the select to go and check for events, but then
 > I fall into the active polling that I'm trying to avoid.

What about having a separate task that would be the main loop, something like
(the syntax is not accurate, this is only to give a rough idea):

   while not Gtk.Main.Main_Iteration (Blocking => True) loop
      Main_Task.Event_Processed;
   end loop;

and a main task that would do all the synchronization:

   loop
      select
        accept Event_Processed do
           ...
        end Event_Processed;
      or
        ...
      end select;
   end loop;

Since Main_Iteratio is blocking, wouldn't something similar to this solve your
problem ? (In fact, Main_Iteration might not be the best function, since it
will process the event)

Emmanuel





More information about the gtkada mailing list