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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: Xl.tags.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 21 Sep 2014 10:59:46 -0500 From: Dennis Lee Bieber Newsgroups: comp.lang.ada Subject: Re: Simp,e example for 2 tasks Date: Sun, 21 Sep 2014 11:59:46 -0400 Organization: IISS Elusive Unicorn Message-ID: References: <9b22dd09-6137-4f4b-8be1-28255032df70@googlegroups.com> X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 108.79.221.234 X-Trace: sv3-apLY5i8/j9JlBua/CI6xVIV4KMKsQcWzwsS7t57PV5OR/MLyYKcPefDCaaViB9081VDb7PRwNSgw+cz!LDKpk3jjNkRXYKtTFC5BvoBfSoZCq7KsMf1GYcteTuqm6vUSPp2QnX2QV5ArZjxloW2KIQ/OY/En!/al/dCdQfqKJdA+YWybxYEsUHZid X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2843 Xref: number.nntp.dca.giganews.com comp.lang.ada:189070 Date: 2014-09-21T11:59:46-04:00 List-Id: On Sun, 21 Sep 2014 06:31:28 -0700 (PDT), Stribor40 declaimed the following: >Would anyone be able to post simple example of ada program showing 2 tasks taking to each other please. For example one task sends message to another saying "hi" and second taks replying "hi back". >I am having troubles finding example of simple program like this online Well... The problem domain is slightly under-specified. Ada doesn't "send message" in the way you may be thinking. It's more a "pass a note during a handshake" (Rendezvous). The problem with your description is that of sequencing. A straight linear interpretation is: Task A Task B begin begin rendezvous with Task B wait for rendezvous from any task end rendezvous wait for rendezvous from any task rendezvous with Task A end rendezvous end end There is nothing being passed there -- the rendezvous itself is the "message". There is also no work being done inside the rendezvous. AND the sequence is pretty much lock-step: B does nothing until A connects, then A does nothing until B decides to connect to it. An alternative would be using an IN and OUT parameter on the rendezvous begin begin rendezvous with B("Hello", reply) wait for rendezvous(IN msg, OUT reply) reply = "Hello Back" end rendezvous end end Here there is only one rendezvous... one "handshake"; A does nothing during the rendezvous until B ends the rendezvous after doing whatever it wants (setting reply). -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/