Do this (added assumed loop statement for clarity):
loop
select
accept Stop;
exit;
or
delay 3.0;
-- do something
end select;
end loop;
Mind that the body of an accept
statement is only necessary if you need to process its parameters. Since Stop
has none, it makes no sense for that accept
statement to have a body.
Your error comes from this rule from the LRM, 5.7:
An exit_statement that applies to a given loop_statement shall not appear within a body or accept_statement, if this construct is itself enclosed by the given loop_statement.
I also changed your else
to an or
so that the Stop
is accepted during the whole waiting time, which I assume is what you want. With else
, the Stop
is only accepted at the time the select
is being executed, not after the delay
has started.