comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Problem with task component
Date: Wed, 19 Sep 2012 19:22:07 +0100
Date: 2012-09-19T19:22:07+01:00	[thread overview]
Message-ID: <m2ehlx50vk.fsf@pushface.org> (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.



             reply	other threads:[~2012-09-19 18:22 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-19 18:22 Simon Wright [this message]
2012-09-19 18:48 ` Problem with task component 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
replies disabled

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