comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: confusion about message passing between the tasks
Date: Sun, 26 Oct 2014 18:27:04 -0400
Date: 2014-10-26T18:27:04-04:00	[thread overview]
Message-ID: <wccppdeo4av.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: m2jlvj$mi6$2@dont-email.me

Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org> writes:

> On 10/26/2014 01:31 PM, Robert A Duff wrote:
>> 
>> ...but the other way around isn't true.  Here's Tucker's example that
>> convinced me that some sort of "pragma Passive(Buffer_Task);" wasn't
>> going to cut it.  Write a PO a that is in one of two states,
>> "accepting calls to Entry_1" and "accepting calls to Entry_2",
>> never in both states at the same time, and never in neither state
>> (as observed by callers).  Pretty easy.  With rendezvous, not so
>> much.
>
> That seems pretty straightforward, whether with a PO or a passive task. Is there
> some complication I'm missing?

Maybe.  Here's my PO code:

    type State_Enum is (Accepting_Entry_1, Accepting_Entry_2);

    protected P is
        entry Entry_1;
        entry Entry_2;
    private
        State: State_Enum := Accepting_Entry_1;
    end P;

    protected body P is

        entry body Entry_1 when State = Accepting_Entry_1 do
            ...
            if ...
                State := Accepting_Entry_2;
        end Entry_1;

        entry body Entry_2 when State = Accepting_Entry_2 do
            ...
            if ...
                State := Accepting_Entry_1;
        end Entry_2;

    end P;

Can you show equivalent code using "accept"?

- Bob


  reply	other threads:[~2014-10-26 22:27 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-24 16:44 confusion about message passing between the tasks compguy45
2014-10-24 18:39 ` Ludovic Brenta
2014-10-25  1:51   ` compguy45
2014-10-25  7:13     ` Ludovic Brenta
2014-10-24 23:49 ` Stribor40
2014-10-25  7:03   ` Ludovic Brenta
2014-10-25  7:58 ` Simon Wright
2014-10-25 13:01   ` compguy45
2014-10-25 14:11     ` Simon Wright
2014-10-25 17:25 ` Dennis Lee Bieber
2014-10-25 17:54   ` Jeffrey Carter
2014-10-25 22:23     ` Robert A Duff
2014-10-25 23:26       ` compguy45
2014-10-26  4:50         ` Dennis Lee Bieber
2014-10-26 10:20         ` Georg Bauhaus
2014-10-26  5:37       ` J-P. Rosen
2014-10-26  8:14         ` Pascal Obry
2014-10-26 15:47           ` J-P. Rosen
2014-10-26 20:27         ` Robert A Duff
2014-10-26 20:31           ` Robert A Duff
2014-10-26 20:36             ` Jeffrey Carter
2014-10-26 22:27               ` Robert A Duff [this message]
2014-10-26 23:23                 ` Jeffrey Carter
2014-10-27  0:46                   ` Robert A Duff
2014-10-27  2:18                     ` Jeffrey Carter
2014-10-27  7:51                     ` J-P. Rosen
2014-10-27  7:44             ` J-P. Rosen
2014-10-26 20:42           ` Dmitry A. Kazakov
2014-10-26 21:15             ` Brad Moore
2014-10-27  9:22               ` Dmitry A. Kazakov
2014-10-26 22:20             ` Robert A Duff
2014-10-27  7:40           ` J-P. Rosen
2014-10-25 23:42 ` compguy45
2014-10-25 23:55   ` compguy45
2014-10-26  0:24     ` Jeffrey Carter
2014-10-26  0:41       ` compguy45
2014-10-26 11:30         ` Brian Drummond
2014-10-26 15:40     ` Simon Wright
replies disabled

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