Going with the logic of your problem rather than the syntax, I think the answer is 'it all depends'.
The task that's running this loop (call it Server
) is in a busy loop (most times round the loop, it'll end up setting A := True; B := True;
). This could use up all your CPU and starve the other tasks out.
Assuming that doesn't happen and you have 2 client tasks A_Caller
and B_Caller
which have higher priority than Server
and call their entries relatively infrequently, then you might get
A_Caller
and B_Caller
both run and call their respective entries.
Server
enters the select
and finds both guards open and the entries called; it chooses to accept A
(it could have chosen B
). The guard B
is closed.
- Next time round the loop, guard
A
is open but there is no caller; guard B
is closed; the else
part is chosen, so guard B
is opened.
- Next time round the loop,
Server
accepts B
; guard A
is closed.
- Next time round the loop, guard
B
is open but there is no caller; the else
part is chosen, so guard A
is opened.
- Next time round the loop, both guards are open but there is no caller, so the
else
part is chosen again and away we spin.
Obviously the exact sequence followed will depend on when the entry calls arrive with respect to Server
's loop. Assuming the entry calls in your question happen a second apart, the entries will be accepted in the order called.
I don't think you can get starvation unless one of the callers is running sufficiently frequently that it's called its entry again before Server
has got back round its loop. It would be hard to get this to happen under a general-purpose OS.