[AWS] Clean Termination

henrik.sundberg at saabsystems.se henrik.sundberg at saabsystems.se
Thu Sep 16 17:17:36 CEST 2004


Well, it works for me, I get a proper response message from the server.

There is no code, exept for the signal-state change in the semaphore. The
shutdown is done by the main task after the semaphore waiting.
My impression of the AWS shutdown implementation is that it lets the
current connections do their work, and that the tasks aren't just aborted.
=> Shutdown waits for the current requests, and I don't need to add any
delays.
      /$



|---------+--------------------------->
|         |           "Ian Broster"   |
|         |           <ian at broster.co.|
|         |           uk>             |
|         |                           |
|         |           2004-09-16 16:59|
|         |                           |
|---------+--------------------------->
  >-------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                         |
  |        To:      henrik.sundberg at saabsystems.se                                                                          |
  |        cc:      aws at lists.act-europe.fr, aws-bounces at lists.act-europe.fr                                                |
  |        Subject: Re: [AWS] Clean Termination                                                                             |
  >-------------------------------------------------------------------------------------------------------------------------|




> 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