From: Bryan@SIERRA.STANFORD.EDU (Doug Bryan)
Subject: a tasking question for you
Date: Sun, 12-Jul-87 02:49:51 EDT [thread overview]
Date: Sun Jul 12 02:49:51 1987
Message-ID: <12317696882.13.BRYAN@Sierra.Stanford.EDU> (raw)
Dear Ada Fans,
After a long summer break, we're back with our pain-in-the-rear
questions. We have a nasty one about the semantics (or lack thereof)
of RM 9.10(7). Consider the following:
with Text_Io;
procedure Main is
type Text is access String;
task A;
task B is
entry E (T : Text);
end B;
T : Text := new String'("xxxx");
task body A is
begin
B.E (T);
exception
when Tasking_Error => Text_Io.Put_Line (T.all & T.all);
end A;
task body B is
begin
accept E (T : Text) do
T.all := "yyyy";
end E;
end B;
begin
abort B;
end Main;
Is it possible for this program to print:
xxxxyyyy
The following scenario seems possible (assuming a single
CPU system simplifies life):
1. the rendezvous begins
2. task B becomes abnormal (but not completed)
3. Tasking_Error is raised in task A
4. task A handles the exception
5. the left-hand operand of "&" is evaluated (yielding "xxxx")
6. task B executes the assignment statement
7. the right-hand operand of "&" is evaluated (yielding "yyyy")
8. the Put_Line takes place
The wording in 9.10(7) seems not to preclude an abnormal task engaged
in a rendezvous from continuing execution AFTER the caller has received
and/or handled Tasking_Error. If this is possible, then the called task
can still be mucking with actual parameters, while the calling task has
continued its own execution.
If this is possible, we'll never use Ada again! 'C' doesn't have this
problem!! :-)
Bonus Question: What does 9.10(8) have to do with the price of eggs?
We don't understand how this could happen.
doug and geoff
-------
next reply other threads:[~1987-07-12 6:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1987-07-12 6:49 Doug Bryan [this message]
-- strict thread matches above, loose matches on Subject: below --
1987-07-13 21:15 a tasking question for you Keith Shillington @prodigal
[not found] <13@<12317696882>
1987-07-14 17:45 ` stt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox