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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,91c58472289c1ab5 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!l34g2000vba.googlegroups.com!not-for-mail From: sjw Newsgroups: comp.lang.ada Subject: Re: Tasks reinitializing Date: Thu, 17 Sep 2009 22:44:19 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <0bf2270c-6998-41f1-9895-b545026f312e@o21g2000vbl.googlegroups.com> <77eaa11a-79c8-43ff-95d5-0e707a445369@u16g2000pru.googlegroups.com> <27127316-ac19-49e0-bb05-1f49ba1a7c4e@v23g2000pro.googlegroups.com> NNTP-Posting-Host: 82.30.110.254 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1253252660 7177 127.0.0.1 (18 Sep 2009 05:44:20 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 18 Sep 2009 05:44:20 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: l34g2000vba.googlegroups.com; posting-host=82.30.110.254; posting-account=_RXWmAoAAADQS3ojtLFDmTNJCT0N2R4U User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8379 Date: 2009-09-17T22:44:19-07:00 List-Id: On Sep 17, 11:39=A0pm, Anh Vo wrote: > On Sep 17, 2:42=A0pm, Adam Beneschan wrote: > > You may want to try using an access: > > > =A0 =A0type Task_Type_Acc is access Task_Type; > > > =A0 =A0Init : Task_Type_Acc :=3D new Task_Type; > > > When you allocate a new Task_Type with "new", that will start a task > > up. =A0If, after the task finishes, you want to start a new one, you ca= n > > assign > > > =A0 =A0Init :=3D new Task_Type; > > > at any point, and it will start a new task. =A0I think that's probably > > what you want. > > Just to make it complete, I would recommend deallocating memory, > before starting a new task, to prevent memory leaks. Yes, but you need to be careful here. If you say abort Init.all; Free (Init); then (at least with GNAT, at least on VxWorks, unless they've changed recently) you may free the task stack but not the task control block. abort Init.all; while not Init.all'Terminated loop delay 0.001; end loop; Free (Init); You might want to figure out a way to delegate the loop and the free to a lower-priority task.