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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no 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!v23g2000pro.googlegroups.com!not-for-mail From: Anh Vo Newsgroups: comp.lang.ada Subject: Re: Tasks reinitializing Date: Thu, 17 Sep 2009 15:39:38 -0700 (PDT) Organization: http://groups.google.com Message-ID: <27127316-ac19-49e0-bb05-1f49ba1a7c4e@v23g2000pro.googlegroups.com> References: <0bf2270c-6998-41f1-9895-b545026f312e@o21g2000vbl.googlegroups.com> <77eaa11a-79c8-43ff-95d5-0e707a445369@u16g2000pru.googlegroups.com> NNTP-Posting-Host: 149.32.224.33 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1253227179 16516 127.0.0.1 (17 Sep 2009 22:39:39 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 17 Sep 2009 22:39:39 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: v23g2000pro.googlegroups.com; posting-host=149.32.224.33; posting-account=Qh2kiQoAAADpCLlhT_KTYoGO8dU3n4I6 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; GTB6; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.1; .NET CLR 3.0.04506.648),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8374 Date: 2009-09-17T15:39:38-07:00 List-Id: On Sep 17, 2:42=A0pm, Adam Beneschan wrote: > On Sep 17, 11:21=A0am, Pablo wrote: > > > How can I reinitialize a task? > > Say us, I have two cases: > > A task defined as > > =A0 =A0task type Task_type is > > =A0 =A0 =A0 entry Start; > > =A0 =A0end Task_type; > > so the object defined as > > Init : Init_type; > > You mean Init : Task_Type, I presume?? > > > and inside a procedure, the task is initialized with > > accept Start; > > > and now: > > 1) In run time, the task is terminated by aborting process (abort > > Init) before its end, and in the same session, I need to turn it on > > again, but now from the beginning. > > 2) In run time, the task is finished by very end, and in the same > > session, I need to start it again from beginning. > > > Please help me! > > You'll need to create a new task object. =A0If you declare an object > > =A0 =A0Init : Task_Type; > > and it's declared as a local variable inside a procedure Proc1, the > only way it's going to get reinitialized is if Proc1 exits and starts > up again. =A0If Init is declared in a library package, then it's never > going to happen. > > 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 can > 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. Anh Vo