comp.lang.ada
 help / color / mirror / Atom feed
From: "Martin Dowie" <martin.dowie@btopenworld.com>
Subject: Re: my program
Date: Mon, 29 Dec 2003 23:02:16 +0000 (UTC)
Date: 2003-12-29T23:02:16+00:00	[thread overview]
Message-ID: <bsqbpo$b20$1@sparta.btinternet.com> (raw)
In-Reply-To: bspfvv$mpo$1@atlantis.news.tpi.pl

"Kasia Krysiak" <kasiool@o2.pl> wrote in message
news:bspfvv$mpo$1@atlantis.news.tpi.pl...
> I'm start to lern ada , and i have some problems...
>  this is my new program, and i have a question how to inicialize
> Task1:Male(Id=>1); Task2:Male(Id=>2); task3:male(id=>3); (last 3 lines of
> code in loop? becouse i should to have the number od male dymaic. I
tryided
> to do this in arry but i couldnt inlicjalize this id's  sorry 4 my english
> it isnt good I KNOW!!! - but I'm trying :)
> task type Male(Id: integer);
[snip]
> Task1:Male(Id=>1);
>
> Task2:Male(Id=>2);
>
> task3:male(id=>3);

You can do this at elaboration:

package body Foo is
   Task_Id : Natural := 0;
   function Get_Id return Positive is
   begin
      Task_Id := Task_Id + 1;
      return Task_Id;
   end Get_Id;
   task type Bar (Id : Natural := Get_Id);
   task body Bar is ... end Bar;
   Tasks : array (1 .. 3) of Bar;
end Foo;

The Lawyers can correct me if I'm wrong but elaboration is
performed sequentially and therefore the Id's are guaranteed
to be unique.







      parent reply	other threads:[~2003-12-29 23:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-29 15:07 my program Kasia Krysiak
2003-12-29 18:16 ` Martin Krischik
2003-12-29 23:02 ` Martin Dowie [this message]
replies disabled

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