Difference between statements inside and outside accept block
Suppose the following (server) task specification:
task type Server_Task is
entry E1(I: Integer);
entry E2;
entry E3;
end Server_Task;
with a (dummy) implementation of:
task body Server_Task is
begin
loop
select
accept E1(I: Integer) do
-- statements inside E1 using I
-- statements inside E1 using I
-- statements inside E1 using I
null;
end;
or
accept E2 do
null;
end;
or
accept E3 do
null;
end;
end select;
end loop;
end Server_Task;
Based on my understanding, if a client task makes an entry call for (say) E1 then all statements inside the E1
accept block will be executed before the server task loops over again and is ready to accept another entry call. The same is true if there are further statements following the end
of the accept block so that again all these will need to run before the task can randevouz with a calling task again.
If that assumption is correct, I'm wondering what the behavioural difference is between the above implementation and the one below:
task body Server_Task is
Temp: Integer;
begin
loop
select
accept E1(I: Integer) do
Temp := I;
end;
-- statements outside E1 using Temp
-- statements outside E1 using Temp
-- statements outside E1 using Temp
or
accept E2 do
null;
end;
or
accept E3 do
null;
end;
end select;
end loop;
end Server_Task;
Will there be a difference if the statements outside E1
make a blocking call and hence the server task is suspended and therefore these statements will then have to somehow compete with any other entry calls made by the task's clients? (though this doesn't make much sense if the task is implemented using just one "thread"?)
For the sake of argument suppose the client code is along the lines of:
ST: Server_Task;
task body Client_Task is
begin
select
ST.E2;
else
-- do something else
null;
end select;
null;
end Client_Task;
Is this behaviour detailed somewhere in the ARM? - Thanks