comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Problem with task component
Date: Wed, 26 Sep 2012 13:49:09 +0200
Date: 2012-09-26T13:49:07+02:00	[thread overview]
Message-ID: <5062ebb3$0$6583$9b4e6d93@newsspool3.arcor-online.net> (raw)
In-Reply-To: <18te37e3kb1vq$.1bbagkhyd6aa1$.dlg@40tude.net>

On 26.09.12 09:27, Dmitry A. Kazakov wrote:

> 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.

But from the software design POV, the client, or its programmer,
always does know that there is an operational dependence if the client
should react to the master's life cycle. I don't understand why this
should not be made explicit?

Also, arguably, a master knowing the clients will create tight coupling
too, for it could otherwise be replaced with some other master. This
could be considered better, more flexible software design.

A registry to the rescue?  (I notice that Ravenscar tasks require
a different model entirely...)

So why not create some measure of autonomy by

   type M is task Interface;
   type M_CRef is access constant M'Class;


   task body Server is
      Master_Task : M_CRef;
   begin
      accept Master (Master_Task : M_CRef) do
	 Server.Master_Task := Master_Task;
      end Master;
      loop
	 select
	    accept ... do ... end;
	 or delay Time_Out;
            exit when not Master_Task.all'Callable;
	 end select;
	 -- do something
      end loop;
   end Server;


Server might even switch masters if the first acceptor is moved
to the loop.




  reply	other threads:[~2012-09-26 11:49 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
2012-09-26 11:49                             ` Georg Bauhaus [this message]
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