comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Tasks reinitializing
Date: Fri, 18 Sep 2009 09:57:44 +0200
Date: 2009-09-18T09:57:44+02:00	[thread overview]
Message-ID: <9cnotgvojmiu.houhcidij6t0$.dlg@40tude.net> (raw)
In-Reply-To: 0bf2270c-6998-41f1-9895-b545026f312e@o21g2000vbl.googlegroups.com

On Thu, 17 Sep 2009 11:21:41 -0700 (PDT), Pablo wrote:

> How can I reinitialize a task?
> Say us, I have two cases:
> A task defined as
>    task type Task_type is
>       entry Start;
>    end Task_type;
> so the object defined as
> Init : Init_type;
> 
> 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.

If the process is aborted, all its tasks are dead. You probably mean
aborting the task. Then just do not abort it if you steel need it.

> 2) In run time, the task is finished by very end, and in the same
> session, I need to start it again from beginning.

task body Task_type is
begin
   loop
      select
         accept Start; -- Wait for a session to start
         ... -- Do what has to be done in this session
      or terminate; -- Complete when no more needed
      end select;
   end loop;
end Task_type;

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



      parent reply	other threads:[~2009-09-18  7:57 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
2009-09-18  7:57 ` Dmitry A. Kazakov [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox