[gtkada] GtkAda and tasking

Robin, Stephe, or Nora leakstan at erols.com
Fri Apr 21 03:56:00 CEST 2000


I think what you'd like is a main loop something like this:

loop
   select
      accept Gtk.Main.Main_Event_Entry do
          ...
      end;
   or
      accept My_Stuff.Main_Event_Entry do
          ...
      end;
  end select;
end loop;

That way, the task is blocked waiting for either a Gtk event or an other event;
no polling involved.

So the question is, can the event queue in Gtk be wrapped in a task entry, 
without polling? Maybe the queue code would have to be modified to change
the guard on a protected object, or some such.

I can't find the real source for the Gtk event queue. Gtk.Main.Main_Iteration calls
'gtk_main_iteration_do', which is in the C file gtk/gtkmain.c. That calls
'g_main_iteration', which I can't find!

-- Stephe

-----Original Message-----
From:	Jean-Pierre Rosen [SMTP:rosen.adalog at wanadoo.fr]
Sent:	Thursday, April 20, 2000 5:01 AM
To:	gtkada at gtkada.eu.org
Subject:	Re: [gtkada] GtkAda and tasking

From: Emmanuel Briot <briot at gnat.com>
> 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)
>
While I'm blocked in Main_Iteration, I can't communicate....
To give you an idea of what I'm trying to do:
it is for a utility to synchronize a laptop with a desktop. The bulk of the
processing is scanning directories, and this is performed by a background
task. When there is a discrepancy, a window asks the user what to do. I'd
like to have a label in that window that tells wich directory is being
processed, so it will be constantly changing, even during user interaction.
Conversely (as I stand now), once the user has clicked on OK, I exit from
the main loop, so the window that stays on the screen cannot be moved any
more (I do not want to have windows popping in and out all the time).
It is likely that I'll have to write my own main loop, but to do so I'd
better have a look at the current main loop. Since it is directly imported
from C, I don't have the source. Where can it be found (if possible, without
downloading the whole Gtk) ?

To be honnest: the current implementation is based on Tash, and I have the
same problem. I'm investigating whether GtkAda could be a better solution.
---------------------------------------------------------
           J-P. Rosen (Rosen.Adalog at wanadoo.fr)
Visit Adalog's web site at http://pro.wanadoo.fr/adalog



_______________________________________________
gtkada mailing list
gtkada at gtkada.eu.org
http://gtkada.eu.org/cgi-bin/mailman/listinfo/gtkada






More information about the gtkada mailing list