On 9/14/06, Zoran Vasiljevic <[EMAIL PROTECTED]> wrote:
On 14.09.2006, at 21:59, Stephen Deasey wrote: > Currently you're cleaning up with a AtExit handler and manually > calculating a timeout to wait for proxies to exit. I think you > really want an AtShutdown callback. These already handle a > notification and then timeout sequence. > > I think at the moment a clean exit will take shutdown-timeout + > proxy-shutdown-timeout, which might be surprising to people. > Hey, isn't AtShutdown done per-thread? [14/Sep/2006:22:44:08][13827.41969152][-shutdown-] Notice: nsproxy: shutdown started [14/Sep/2006:22:44:08][13827.2684415384][-main-] Notice: driver: shutdown complete [14/Sep/2006:22:44:08][13827.2684415384][-main-] Notice: spooler0: shutdown complete [14/Sep/2006:22:44:08][13827.41969152][-shutdown-] Notice: nsproxy: shutdown pending [14/Sep/2006:22:44:08][13827.41968128][-nsproxy:reap-] Notice: exiting [14/Sep/2006:22:44:08][13827.41969152][-shutdown-] Notice: nsproxy: shutdown complete [14/Sep/2006:22:44:08][13827.41969152][-shutdown-] Notice: nslog: closed '/usr/local/ns/logs/access.log' [14/Sep/2006:22:44:08][13827.2684415384][-main-] Notice: nsproxy: shutdown started [14/Sep/2006:22:44:08][13827.2684415384][-main-] Notice: nsproxy: shutdown complete [14/Sep/2006:22:44:08][13827.2684415384][-main-] Notice: nsmain: NaviServer/4.99.2 exiting I have the proc running twice which should'nt be? Was the AtExit a better solution?
AtShutdown callbacks are called twice: the first time is to allow you to notify threads that they should begin cleaning up for shutdown; the second time you should actually wait for the shutdown to complete, taking note of the absolute timeout value. Look at some of the existing code that handles this. There's 3 or 4 AtShutdown procs in the core. The interface is kind of ugly, I agree. I always have to look up what I'm supposed to do. Suggestions appreciated!