From: Stribor40 <ikamzic@gmail.com>
Subject: Re: Simp,e example for 2 tasks
Date: Sun, 21 Sep 2014 09:03:39 -0700 (PDT)
Date: 2014-09-21T09:03:39-07:00 [thread overview]
Message-ID: <ad8f8ebd-60dc-46a4-a364-2fc3a6a52047@googlegroups.com> (raw)
In-Reply-To: <ljst1ahlc3oda0ahrjjsdq46bh5jnq7j9c@4ax.com>
>
>
>
> >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.
next prev parent reply other threads:[~2014-09-21 16:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-21 13:31 Simp,e example for 2 tasks Stribor40
2014-09-21 15:59 ` Dennis Lee Bieber
2014-09-21 16:03 ` Stribor40 [this message]
2014-09-21 22:26 ` Dennis Lee Bieber
2014-09-21 16:09 ` Dmitry A. Kazakov
2014-09-21 16:28 ` Stribor40
2014-09-21 17:00 ` Brad Moore
2014-09-21 20:33 ` Jeffrey Carter
2014-09-22 7:18 ` Niklas Holsti
2014-09-22 17:48 ` Jeffrey Carter
2014-09-22 18:16 ` Niklas Holsti
2014-09-22 19:27 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox