comp.lang.ada
 help / color / mirror / Atom feed
From: john@nospam.demon.co.uk (John McCabe)
Subject: Re: DYNAMIC ADA TASK CREATION?
Date: Wed, 18 Jun 2003 11:13:37 +0000 (UTC)
Date: 2003-06-18T11:13:37+00:00	[thread overview]
Message-ID: <3ef04842.436197@news.btclick.com> (raw)
In-Reply-To: bcpas1$esp$1@a1-hrz.uni-duisburg.de

On Wed, 18 Jun 2003 09:20:01 +0000 (UTC), Georg Bauhaus
<sb463ba@d2-hrz.uni-duisburg.de> wrote:


>: Correct.  But if you don't want to get stuck there, do this instead:
>: 
>:     -- task type t as above
>:     type ta is access t;
>: 
>:     type ts is array (positive range <>) of ta := new t;
>                                                 ^^^^^^^^  
>I think I got the idea and made me program to see the tasks working
>outside the declare block. A good hint!
>But is new t on the line above some new default initialisation
>construct, or meant to abbreviate something? (The compiler complains.)
: 
:     declare
:       the_ts : ts (1 .. n);
:     begin
:       --  do something with the tasks
:       --  NB, CAN pass this once all the tasks have been created.
:     end;
: 

I'm not surprised, you're trying to initialise a type!! Simon did say
he hadn't compiled this though!

You need to remove the ' := new t' at the end, then actually create
the tasks something like:

-- task type t as above
type ta is access t;

type ts is array (positive range <>) of ta;

declare
   the_ts : ts (1 .. n);
begin
   for Index in 1 .. n loop
      the_ts(n) := new t;
   end loop;

   --  do something with the tasks
   --  NB, CAN pass this once all the tasks have been created.
end;

Just a vague thought....does..

declare
   the_ts : ts (1 .. n) = (others => new t);
begin
....

compile?


Best Regards
John McCabe

To reply by email replace 'nospam' with 'assen'



  reply	other threads:[~2003-06-18 11:13 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-17 19:53 DYNAMIC ADA TASK CREATION? avram
2003-06-17 20:24 ` Simon Wright
2003-06-18  6:11   ` Robert I. Eachus
2003-06-18  9:20     ` Georg Bauhaus
2003-06-18 11:13       ` John McCabe [this message]
2003-06-18 12:43         ` John McCabe
2003-06-18 14:17           ` Georg Bauhaus
2003-06-19  5:07         ` Simon Wright
2003-06-19  6:05           ` Robert I. Eachus
2003-06-19 23:30             ` Jeffrey Carter
2003-06-18 19:15     ` avram
2003-06-18 21:17       ` Craig Carey
2003-06-20 18:56         ` avram
2003-06-21 13:06           ` Pascal Obry
2003-06-18 23:28       ` Robert I. Eachus
2003-06-19  5:09         ` Simon Wright
2003-06-19  6:39           ` Robert I. Eachus
2003-06-19 20:34             ` Simon Wright
2003-06-28  0:54             ` Matthew Heaney
2003-06-28  7:25               ` Robert I. Eachus
2003-06-30  7:35                 ` Dmitry A. Kazakov
2003-06-30 15:01                   ` Matthew Heaney
2003-07-01  7:19                     ` Dmitry A. Kazakov
2003-07-01 14:21                       ` Matthew Heaney
2003-07-02 12:05                     ` Mário Amado Alves
2003-07-02 19:41                       ` Simon Wright
2003-07-03 21:31                         ` Mário Amado Alves
2003-07-03  9:53                   ` Robert I. Eachus
replies disabled

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