comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Task question...
Date: 1997/10/21
Date: 1997-10-21T00:00:00+00:00	[thread overview]
Message-ID: <EIEHv0.A94@world.std.com> (raw)
In-Reply-To: 344580FA.478A@eelab.su.oz.au


In article <344580FA.478A@eelab.su.oz.au>,
Paul Van Gorp  <paulvg@eelab.su.oz.au> wrote:
>task type t1 is
>       entry reply;
>       ...
>end t1;
>
>task type t2 is
>       ...
>end t2;
>
>task body t1 is
>       T: t2;
>begin
>       loop
>               select
>                       accept reply;
>                       T.do_something;
>                       ...
>               or
>                       ...
>                       T.do_something_else;
>                       ...
>               end select;
>       end loop;
>end t1;
>
>task body t2 is
>begin
>       loop
>               select
>                       ...
>                       -- what I want here, is to invoke t1.reply
>                       -- from within different instances of T1
>                       -- if you know what I mean
>               end select;
>       end loop;
>end t2;

You can put t2 inside t1, like this:

task type t1 is
        entry reply;
        ...
end t1;

task body t1 is

        task t2 is -- Not "task type t2 is..."
                ...
        end t2;

        task body t2 is
        begin
                loop
                        select
                                reply; -- Or, if you prefer, "T1.reply;"
                        ...
                        end select;
                end loop;
        end t2;

begin
        loop
                select
                        accept reply;
                        T2.do_something;
                        ...
                or
                        ...
                        T2.do_something_else;
                        ...
                end select;
        end loop;
end t1;

Alternatively, you could use an access discriminant on T2 pointing to
T1.

- Bob




  parent reply	other threads:[~1997-10-21  0:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-10-16  0:00 Task question Paul Van Gorp
1997-10-19  0:00 ` elaine.waybright
1997-11-01  0:00   ` Matthew Heaney
1997-10-21  0:00 ` Robert A Duff [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-12-10 22:12 shaunpatterson
2007-12-10 22:29 ` gpriv
2007-12-10 22:51   ` shaunpatterson
2007-12-10 23:13     ` gpriv
2007-12-10 23:40 ` Robert A Duff
2007-12-11  0:43 ` anon
1997-10-06  0:00 Larry Coon
1997-10-07  0:00 ` Matthew Heaney
1997-10-07  0:00   ` Larry Coon
1997-10-07  0:00 ` David C. Hoos, Sr.
1997-10-07  0:00   ` Larry Coon
1997-10-07  0:00   ` Steve O'Neill
1997-10-08  0:00   ` Matthew Heaney
1997-10-08  0:00   ` Tom Moran
1997-10-07  0:00 ` Robert A Duff
1997-10-13  0:00   ` Larry Coon
1997-10-30  0:00 ` Balmacara9
1996-09-15  0:00 task question Nicolay Belofastow
1996-09-23  0:00 ` Matthew Heaney
     [not found] <204266@QZCOM>
1986-09-26 17:28 ` Task question Matts_Kallioniemi_QZ
replies disabled

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