Here your program produces output
$ ./protected_imp
coins 6
no request received for 5 secondsno request received for 5 secondsno request received for 5 seconds^C
(I stopped him at that moment).
"coins 6" - this is exactly the result that he should give; You have added 1 to the starting value (1) 5 times.
, Tasking_Error, , , select ; , go.add, select , go.add , .
task arrives at select; all the alternatives are closed
main calls go.add (1)'
task accepts the entry, increments x, exits the select, and goes round the loop again to wait at the select
main calls go.add (1)
task accepts the entry, increments x, exits the select, and goes round the loop again to wait at the select
main calls go.add (1)
task accepts the entry, increments x, exits the select, and goes round the loop again to wait at the select
main calls go.add (1)
task accepts the entry, increments x, exits the select, and goes round the loop again to wait at the select
main calls go.add (1)
task accepts the entry, increments x, exits the select, and goes round the loop again to wait at the select
main calls go.read
task accepts the entry, prints out "coins 6", and goes round the loop again to wait at the select
main finishes and waits until the task terminates, which it doesn’t, because
after 5 seconds, the select’s delay alternative opens, so the task takes it, prints the message (it should really use Put_Line) and goes round the loop again to wait at the select
after 5 seconds, the select’s delay alternative opens, so the task takes it, prints the message and goes round the loop again to wait at the select
...