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.4 required=5.0 tests=BAYES_00,SUBJ_ALL_CAPS autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,51359402da60c472 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-18 02:20:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.vmunix.org!newsfeed.hanau.net!news-fra1.dfn.de!news-koe1.dfn.de!RRZ.Uni-Koeln.DE!uni-duisburg.de!not-for-mail From: Georg Bauhaus Newsgroups: comp.lang.ada Subject: Re: DYNAMIC ADA TASK CREATION? Date: Wed, 18 Jun 2003 09:20:01 +0000 (UTC) Organization: GMUGHDU Message-ID: References: <3EF0026E.2050309@attbi.com> NNTP-Posting-Host: d2-hrz.uni-duisburg.de X-Trace: a1-hrz.uni-duisburg.de 1055928001 15257 134.91.1.15 (18 Jun 2003 09:20:01 GMT) X-Complaints-To: usenet@news.uni-duisburg.de NNTP-Posting-Date: Wed, 18 Jun 2003 09:20:01 +0000 (UTC) User-Agent: tin/1.5.8-20010221 ("Blue Water") (UNIX) (HP-UX/B.11.00 (9000/831)) Xref: archiver1.google.com comp.lang.ada:39382 Date: 2003-06-18T09:20:01+00:00 List-Id: Robert I. Eachus wrote: : Simon Wright wrote: : :> (uncompiled) :> :> task type t is :> -- some entries :> end t; :> :> task body t is :> begin :> -- code :> end t; :> :> type ts is array (positive range <>) of t; :> :> n : positive; :> :> begin :> :> -- read in n :> :> declare :> the_ts : ts (1 .. n); :> begin :> -- do something with the tasks :> -- NB, can't pass this point until all the tasks have terminated :> end; : : 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; : : For an ordinary task object, the creator of the object is the master (in : the original example, a declare block. But for a task created by an : allocator, the place where the access type was declared determines who : is the master. (In either case, if that is in a library package, the : master is the environment task.) : -- Georg