comp.lang.ada
 help / color / mirror / Atom feed
From: "J-P. Rosen" <rosen@adalog.fr>
Subject: Re: "C - like: THIS" pointer to a task type inside a task function
Date: Tue, 24 Jan 2012 07:39:56 +0100
Date: 2012-01-24T07:39:56+01:00	[thread overview]
Message-ID: <jfljns$ksv$1@dont-email.me> (raw)
In-Reply-To: <ca5e2bb1-52e1-43fa-bd06-49a02ce29c7c@k29g2000vbl.googlegroups.com>

Le 23/01/2012 20:32, Ada BRL a �crit :

I too have concerns about your design, but to answer your specific question:
> 			accept Send_Data(Data, Ti) do -- ===> Problem here! How can I
> retrieve Ti object. I think I need a "this" pointer inside the task
> body. Ti has to notify T4 who's the sender of data.
> 
Inside the body of T1 (or any task type), the name T1 acts as a "this",
i.e. it is not interpreted as a task type, but as a name that designate
the current task. If all your clients are of the same type, use an
access to this task type and T1'access can be used as a pointer to the
current task.

If you need several task types, use a pointer to an interface that all
task types implement.

But there can be many other solutions, assuming you really need
two-stage communication. F.E., if know you have a limited number of
clients, Retrieve_Data could be turned into an entry family, and
Send_Data would provide a token (index into the entry family) where the
client would retrieve its own data. This way, it's always the client who
calls the server.
-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr



  parent reply	other threads:[~2012-01-24  6:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-23 19:32 "C - like: THIS" pointer to a task type inside a task function Ada BRL
2012-01-23 19:59 ` Dmitry A. Kazakov
2012-01-23 22:17   ` tmoran
2012-01-24  8:47     ` Dmitry A. Kazakov
2012-01-24 17:12   ` Ada BRL
2012-01-24 18:43     ` Dmitry A. Kazakov
2012-01-25 12:43       ` Ada BRL
2012-01-25 13:48         ` Dmitry A. Kazakov
2012-01-25 15:05           ` Ada BRL
2012-01-25 18:10             ` Dmitry A. Kazakov
2012-01-26 15:19               ` Ada BRL
2012-01-26  4:17           ` Randy Brukardt
2012-01-24 17:27   ` Ada BRL
2012-01-23 20:20 ` Jeffrey Carter
2012-01-24 17:13   ` Ada BRL
2012-01-24  6:39 ` J-P. Rosen [this message]
2012-01-25  0:42 ` Adam Beneschan
2012-01-25  0:46   ` Adam Beneschan
2012-01-25  7:38   ` J-P. Rosen
replies disabled

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