[AWS] Clean Termination
Ian Broster
ian at broster.co.uk
Thu Sep 16 16:59:54 CEST 2004
> I solved this by adding a semaphore (protected type).
> The line after the start of the server just waits for the semaphore, and
> after that shutdown is called.
> My callback handler signals the semaphore when shutdown is requested
> through the web-page.
This would not work. Follow this through:
1 The protected action (the signal) is executed before the request
completes.
2 On exit from the protected procedure, the guard on the entry would be
opened,
3 however the entry code could be executed immediatly "BY" the request
task
(NOT the main program).
4 In effect, it would actually execute as "part of" the protected
procedure.
Thus there is a race condition.
An aside for number 3: recall that the language
does not allow calling of current_task during
an entry call (in order to allow an implementation
to do the above). However, if you try with GNAT, you
will not get an error and you willsee that the current_task
really is the signalling task.
ian
--
Dr Ian Broster
More information about the AWS
mailing list