From: Adam Beneschan <adam@irvine.com>
Subject: Re: embed accept statement in procedures not possible?
Date: 4 May 2007 12:45:01 -0700
Date: 2007-05-04T12:45:01-07:00 [thread overview]
Message-ID: <1178307901.263809.221480@n76g2000hsh.googlegroups.com> (raw)
In-Reply-To: <snof1f.atk.ln@hunter.axlog.fr>
On May 4, 9:58 am, Jean-Pierre Rosen <r...@adalog.fr> wrote:
> Gerd a écrit :
>
> > My code (schematic only):
>
> > task t is
> > entry e;
> > end t;
>
> > task body t is
> > procedure p is
> > begin
> > accept e;
> > end p;
> > begin
> > p;
> > end t;
>
> > GNAT tells me: "enclosing body for accept must be a task". But - the
> > accept in procedure p _is_ in a task. So why is this not allowed?
>
> True. An accept statement must be *immediately* within a task body, not
> in anything enclosed in the task body.
>
> That rule is necessary to ensure that a task can accept only its own
> entries. Your example is of course very simple, but consider that a task
> can be included in another task. What if Inner_Task called your P procedure?
Actually, though, why is a syntactic rule necessary (as opposed to a
run-time check)?
Not that I'm proposing a language change. This is an area I haven't
really given any thought, so I can't say whether the restriction that
prevents "accept" from being done inside a procedure makes life too
burdensome. But would there be any serious difficulty in changing the
rules so that an "accept" statement is legal inside a procedure, but
raises an exception if the statement is executed under the control of
a task other than the one whose entry is being accepted? Off the top
of my head (and after about six seconds' worth of thought), I don't
see why this would be unfeasible.
-- Adam
next prev parent reply other threads:[~2007-05-04 19:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-04 15:04 embed accept statement in procedures not possible? Gerd
2007-05-04 16:58 ` Jean-Pierre Rosen
2007-05-04 19:45 ` Adam Beneschan [this message]
2007-05-09 7:12 ` Jean-Pierre Rosen
2007-05-09 14:56 ` Adam Beneschan
2007-05-10 11:43 ` Jean-Pierre Rosen
2007-05-10 17:26 ` Pascal Obry
2007-05-04 17:03 ` (see below)
2007-05-04 21:22 ` adaworks
2007-05-05 23:54 ` Stephen Leake
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox