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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.66.252.6 with SMTP id zo6mr20139574pac.40.1411315420504; Sun, 21 Sep 2014 09:03:40 -0700 (PDT) X-Received: by 10.183.1.34 with SMTP id bd2mr29219obd.6.1411315420391; Sun, 21 Sep 2014 09:03:40 -0700 (PDT) Path: border2.nntp.dca1.giganews.com!nntp.giganews.com!a13no1103139igq.0!news-out.google.com!rp1ni1450igb.0!nntp.google.com!a13no1103131igq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 21 Sep 2014 09:03:39 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=24.36.114.177; posting-account=Lb5doAoAAAAWHET3z2_nBVbFSXaZQG1V NNTP-Posting-Host: 24.36.114.177 References: <9b22dd09-6137-4f4b-8be1-28255032df70@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Simp,e example for 2 tasks From: Stribor40 Injection-Date: Sun, 21 Sep 2014 16:03:40 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: number.nntp.dca.giganews.com comp.lang.ada:189071 Date: 2014-09-21T09:03:39-07:00 List-Id: > > > > >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 tasks 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). > > > > > > -- > can I be greedy and ask you can make actuall code that will compile so i can play with it please.