comp.lang.ada
 help / color / mirror / Atom feed
* Problem with task component
@ 2012-09-19 18:22 Simon Wright
  2012-09-19 18:48 ` Dmitry A. Kazakov
  2012-09-19 19:44 ` Adam Beneschan
  0 siblings, 2 replies; 24+ messages in thread
From: Simon Wright @ 2012-09-19 18:22 UTC (permalink / raw)


If a Limited_Controlled type has a component of a task type, is it wrong
to call an entry of the task from Initialize? When I do, the caller
blocks.

   package Chips is

      type Chip is limited private;

   private

      task type Polling_Task (For_Chip : not null access Chip) is
         entry Start;
         entry Stop;
      end Polling_Task;

      type Chip is new Ada.Finalization.Limited_Controlled with record
         Polling_Interval : Duration := 0.1;
         Poller           : Polling_Task (For_Chip => Chip'Access);
      end record;

      overriding
      procedure Initialize (C : in out Chip);

...

   package body Chips is

      task body Polling_Task is
      begin
         accept Start;
         ...
      end Polling_Task;

      overriding
      procedure Initialize (C : in out Chip)
      is
      begin
         C.Poller.Start;      <=========== sticks here
      end Initialize;

...

If the task won't start executing until its instance is completely
elaborated and initialized, I don't need the entry Start in any case.



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

end of thread, other threads:[~2012-09-30  1:18 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-19 18:22 Problem with task component Simon Wright
2012-09-19 18:48 ` Dmitry A. Kazakov
2012-09-19 20:40   ` Simon Wright
2012-09-19 21:11     ` Dmitry A. Kazakov
2012-09-19 21:48       ` Simon Wright
2012-09-24  5:28         ` J-P. Rosen
2012-09-24  8:23           ` Simon Wright
2012-09-24 13:37             ` J-P. Rosen
2012-09-24 14:17               ` Simon Wright
2012-09-24 17:53               ` Robert A Duff
2012-09-24 20:40                 ` J-P. Rosen
2012-09-24 15:44             ` Adam Beneschan
2012-09-24 16:13               ` AdaMagica
2012-09-24 16:43                 ` Adam Beneschan
2012-09-24 16:29               ` Dmitry A. Kazakov
2012-09-24 20:49                 ` J-P. Rosen
2012-09-25  7:35                   ` Dmitry A. Kazakov
2012-09-25 17:52                     ` J-P. Rosen
2012-09-25 18:35                       ` Dmitry A. Kazakov
2012-09-25 19:22                         ` J-P. Rosen
2012-09-26  7:27                           ` Dmitry A. Kazakov
2012-09-26 11:49                             ` Georg Bauhaus
2012-09-26 14:13                               ` Dmitry A. Kazakov
2012-09-19 19:44 ` Adam Beneschan

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