On Sun, 31 Oct 2004, Robert Klemme wrote:

> Well, I don't know the rest of your application.  The crucial part is IMHO
> who creates all those threads.  In a common TCPServer situation where one
> thread just waits for a connection and then fires off a new thread for each
> session, you would want to make sure that this does not happen any more once
> the process should terminate (notified via a signal, a message via thread or
> whatever).  IMHO it's the cleanest solution to record this overall
> application state ("shutdown in progess") somewhere in order to react
> properly on this.  Once this has happened you only need to iterate and join
> once through all running threads and that's it.  It's the cleanest
> application design which does not leave any holes for bugs sneaking in when
> you install that application on another machine with other performance
> characteristics.  But as I said, it depends on your overall application
> architecture.

almost exactly what i'm doing...  basically i set a global variable when a
signal is caught and all parts of the the code respect this variable at the
appropriate time.

-a
--
===============================================================================
| EMAIL   :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE   :: 303.497.6469
| When you do something, you should burn yourself completely, like a good
| bonfire, leaving no trace of yourself.  --Shunryu Suzuki
===============================================================================