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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,57893ac51069959a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.213.68 with SMTP id nq4mr6050594pbc.2.1327348794123; Mon, 23 Jan 2012 11:59:54 -0800 (PST) Path: lh20ni216019pbb.0!nntp.google.com!news1.google.com!eweka.nl!feeder.eweka.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!news.stack.nl!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: "C - like: THIS" pointer to a task type inside a task function Date: Mon, 23 Jan 2012 20:59:49 +0100 Organization: cbb software GmbH Message-ID: <19cglxkm60u91.1ezey0dra41do$.dlg@40tude.net> References: Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: CNp+VBSYV+ysZXOiVRxJxw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2012-01-23T20:59:49+01:00 List-Id: On Mon, 23 Jan 2012 11:32:39 -0800 (PST), Ada BRL wrote: > I've N clients and one server that communicate each other. > The N clients retrieve data dynamically, send it to the server throgh > enrty call (obviously the server can accept just one call per time) > and wait for the reply from the server (through accept statement). A server cannot wait for itself either "through accept statement" or any other way. T4.Send_Data (Data); accept Retrieve_Data (Data); is a patented way to run into a deadlock. > For this reason the server needs to know on which client call the > entry: That does not follow. Why do the server need to know the caller? > package P1 is > > task type T1 is > entry Retrieve_Data(Data : String); entry Exchange_Data (Data : in out String); An entry can have in, out, in-out parameters like a subprogram call. You can pass parameters in and get the results out, just in one call. > I think this is a quite common problem and so I'm optimistic to > receive some useful replies! It is considered bad design when two components know each other. Usually the software is designed in a way that component relationships are asymmetric, e.g. the callee knows nothing about the caller. Component knows nothing about the container, etc. The advantage of this approach is its robustness. You can have as many callers you need without changing the callee. Imagine, that sine from the math library would have to be modified each time somebody writes a program calling it. For concurrency symmetric relationships impose an additional risk of deadlocking. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de