From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.2 required=5.0 tests=BAYES_00,FROM_WORDY, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e8e46d5e07d7fa11 X-Google-Attributes: gid103376,public From: "Nick Roberts" Subject: Re: task finished? Date: 1998/05/17 Message-ID: <6jmf3b$h3a$1@plug.news.pipex.net>#1/1 X-Deja-AN: 353997831 References: <01bc620a$7efdf9a0$LocalHost@default> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: UUNET WorldCom server (post doesn't reflect views of UUNET WorldCom) Newsgroups: comp.lang.ada Date: 1998-05-17T00:00:00+00:00 List-Id: Tasks created through access types ... commence activation immediately upon evaluation of the allocator whether it occurs in a sequence of statements or an initial value ... activation is completed before the allocator returns with the access value. Furthermore, such tasks are not dependent upon the unit where they are created but are dependent on the block, subprogram body, or task body containing the declaration of the access type itself. [Programming in Ada 95, John Barnes; Addison-Wesley 1996] So, all you have to do is to put the declaration of the access type which access your tasks immediately in the block you want to be synchronised with their termination. For example: procedure Firework_Display is task type Firework_Controller is ... end; type Controller_Access is access Firework_Controller; FA: array (1..200) of Controller_Access; begin for i in 1..200 loop FA(i) := new Firework_Controller; end loop; end Firework_Display; By the time a call to the procedure Firework_Display returns, all the Firework_Controller tasks have terminated. This is because their access type, Controller_Access, is declared within the Firework_Display procedure, so all the tasks (allocated to this access type) are dependent on the Firework_Display procedure. Note that the entire loop could have been omitted by initialising the FA array with (others => new Firework_Controller). Behaviour would be the same, in this case. [Must dash now to cook the dinner!] -- Nick Roberts ThoughtWing Software, Croydon, UK ThoughtWing@dial.pipex.com Markus Falsinger wrote in message <01bc620a$7efdf9a0$LocalHost@default>... |I have created a number of tasks, but to continue with a procedure I have |to wait until they all have terminated. How can I check whether they all |have terminated or not? (They all have the same name, created in a loop)