comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Problem with task component
Date: Wed, 26 Sep 2012 09:27:58 +0200
Date: 2012-09-26T09:27:58+02:00	[thread overview]
Message-ID: <18te37e3kb1vq$.1bbagkhyd6aa1$.dlg@40tude.net> (raw)
In-Reply-To: k3t09u$um0$1@dont-email.me

On Tue, 25 Sep 2012 21:22:37 +0200, J-P. Rosen wrote:

> Le 25/09/2012 20:35, Dmitry A. Kazakov a �crit :
>> I need not to consider that. Termination of a task is normally determined
>> solely by its master (terminating) and its internal state (open terminate
>> alternative). I.e. strictly top-down.
> 
> IIUC, the scheme you have in mind is a server task which, at some point,
> either accepts calls from its master, or delays and do some processing,
> but you want it to halt if the master is completed. You can write it
> this way:
> 
> task body Server is
> begin
>    loop
>       select
>         accept ... do ... end;
>       or delay Time_Out;
>          exit when not Master_Task'Callable;
>       end select;
>       -- do something
>    end loop;
> end Server;
> 
> Note that when the master completes (for whatever reason, including
> unhandled exception or abort), it is not terminated since it has to wait
> for its dependent tasks, but it is no more callable. That's why you have
> to check 'Callable and not 'Terminated.

The weakness of this approach is that the client must know its master. It
is almost never the case. And it is tight coupling from the software design
POV.

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



  reply	other threads:[~2012-09-26  7:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-19 18:22 Problem with task component Simon Wright
2012-09-19 18:48 ` Dmitry A. Kazakov
2012-09-19 20:40   ` Simon Wright
2012-09-19 21:11     ` Dmitry A. Kazakov
2012-09-19 21:48       ` Simon Wright
2012-09-24  5:28         ` J-P. Rosen
2012-09-24  8:23           ` Simon Wright
2012-09-24 13:37             ` J-P. Rosen
2012-09-24 14:17               ` Simon Wright
2012-09-24 17:53               ` Robert A Duff
2012-09-24 20:40                 ` J-P. Rosen
2012-09-24 15:44             ` Adam Beneschan
2012-09-24 16:13               ` AdaMagica
2012-09-24 16:43                 ` Adam Beneschan
2012-09-24 16:29               ` Dmitry A. Kazakov
2012-09-24 20:49                 ` J-P. Rosen
2012-09-25  7:35                   ` Dmitry A. Kazakov
2012-09-25 17:52                     ` J-P. Rosen
2012-09-25 18:35                       ` Dmitry A. Kazakov
2012-09-25 19:22                         ` J-P. Rosen
2012-09-26  7:27                           ` Dmitry A. Kazakov [this message]
2012-09-26 11:49                             ` Georg Bauhaus
2012-09-26 14:13                               ` Dmitry A. Kazakov
2012-09-19 19:44 ` Adam Beneschan
replies disabled

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