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,FREEMAIL_FROM, 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 12:15:06 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail From: "avram" Newsgroups: comp.lang.ada Subject: Re: DYNAMIC ADA TASK CREATION? Date: Wed, 18 Jun 2003 21:15:02 +0200 Organization: tp.internet - http://www.tpi.pl/ Message-ID: References: <3EF0026E.2050309@attbi.com> NNTP-Posting-Host: pi127.warszawa.cvx.ppp.tpnet.pl X-Trace: nemesis.news.tpi.pl 1055963735 14111 213.76.104.127 (18 Jun 2003 19:15:35 GMT) X-Complaints-To: usenet@tpi.pl NNTP-Posting-Date: Wed, 18 Jun 2003 19:15:35 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Xref: archiver1.google.com comp.lang.ada:39408 Date: 2003-06-18T21:15:02+02:00 List-Id: Thanx very much. I have one more question. What about task memory deallocation. How to wait untill task ends? Is it possible to deallocate memory after the end of task from "parent task" ? avram Uzytkownik "Robert I. Eachus" napisal w wiadomosci news:3EF0026E.2050309@attbi.com... > Simon Wright wrote: > > >> How to create dynamic for example N tasks. I don't know how create N of > >>tasks and array (not list). For example user interface gets an Integer (N) > >>from user and then we create N number of Task in ADA. How to do this?Can > >>anybody help me? > > > > > > (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; > > n : positive; > > begin > > -- read in n > > 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.) >