Reputation: 77
I have a question regarding the "select then abort" language construct in Ada. The task I'm using looks something like:
select
delay 1.0;
do something with the partial result;
then abort
loop
...
long calculation
...
entry call to other task;
...
end loop;
end select;
Can the code in the abort branch be aborted anywhere or only at certain points like delay statements or entry calls? In my program the code in the abort branch performs a long calculation and when aborted the partial calculated result is still useful. But if the code can be interrupted anywhere the problem of data inconsistencies arises.
Thank you
Upvotes: 3
Views: 3107
Reputation: 6430
The abort can happen anywhere, except in an abort deferred region. A protected operation is an abort deferred region, so you can store your partial results inside a protected object.
Upvotes: 2