comp.lang.ada
 help / color / mirror / Atom feed
* Task with access to itself?
@ 2012-12-05 13:53 Jacob Sparre Andersen
  2012-12-05 14:18 ` Dmitry A. Kazakov
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Jacob Sparre Andersen @ 2012-12-05 13:53 UTC (permalink / raw)


I would like to maintain a collection of tasks, where the tasks
themselves can register their availability.

My immediate thought was to let the tasks know their own address
('Access), such that they can simply pass that to the collection of
available tasks, when they are ready.  But I haven't found a nice way to
implement that pattern, so may be I should do it a different way.

   type Handler is
   type Reference is access all Handler;

   task type Handler is
      entry Set (Self : in     Reference);
      entry Do_Stuff (...);
   end Handler;

   task body Handler is
      Pointer : Reference;
   begin
      accept Set (Self : in     Reference) do
         Pointer := Self;
      end Set;

      loop
         accept Do_Stuff (...) do
            ...
         end Do_Stuff;

         ...

         Register_As_Available (Pointer);
      end loop;
   end Handler;

Any suggestions?

Jacob
-- 
... but, following long-established custom, it is Laplace's result
that is always called, in the modern litterature, "Bayes' theorem." (Jaynes)



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-12-13  8:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-05 13:53 Task with access to itself? Jacob Sparre Andersen
2012-12-05 14:18 ` Dmitry A. Kazakov
2012-12-05 16:57 ` Jeffrey Carter
2012-12-11 11:21   ` Jacob Sparre Andersen
2012-12-11 20:39     ` Jeffrey Carter
2012-12-12 20:25       ` Jacob Sparre Andersen
2012-12-12 21:11         ` Jeffrey Carter
2012-12-13  7:20           ` Jacob Sparre Andersen
2012-12-06  9:38 ` Egil Høvik
2012-12-06 19:53   ` Adam Beneschan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox