From: sjw <simon.j.wright@mac.com>
Subject: Re: Tasks reinitializing
Date: Thu, 17 Sep 2009 22:44:19 -0700 (PDT)
Date: 2009-09-17T22:44:19-07:00 [thread overview]
Message-ID: <ed5c3c78-1edb-4e7a-be34-b9e3f8f6b9a0@l34g2000vba.googlegroups.com> (raw)
In-Reply-To: 27127316-ac19-49e0-bb05-1f49ba1a7c4e@v23g2000pro.googlegroups.com
On Sep 17, 11:39 pm, Anh Vo <anhvofrc...@gmail.com> wrote:
> On Sep 17, 2:42 pm, Adam Beneschan <a...@irvine.com> wrote:
> > You may want to try using an access:
>
> > type Task_Type_Acc is access Task_Type;
>
> > Init : Task_Type_Acc := new Task_Type;
>
> > When you allocate a new Task_Type with "new", that will start a task
> > up. If, after the task finishes, you want to start a new one, you can
> > assign
>
> > Init := new Task_Type;
>
> > at any point, and it will start a new task. I 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.
next prev parent reply other threads:[~2009-09-18 5:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-17 18:21 Tasks reinitializing Pablo
2009-09-17 21:42 ` Adam Beneschan
2009-09-17 22:39 ` Anh Vo
2009-09-18 5:44 ` sjw [this message]
2009-09-18 7:57 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox