Re: apr and shutdown
Ben Collins <[email protected]> Sun, 20 Jun 2004 09:30:38 -0400
| Newsgroups | gmane.comp.lang.prothon.devel |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Jun 19, 2004 at 09:20:46PM -0700, Mark Hahn wrote: > Ben Collins wrote: > > I'm posting this on prothon-dev. > > > On Fri, Jun 18, 2004 at 06:40:01PM -0700, Mark Hahn wrote: > >> Right now when I click on the go-away box in the upper-right of a > >> win32 prothon console window, the Prothon app exits immediately > >> without my shutdown code running. > >> > >> Can you tell me the standard C way to intercept a console shutdown? > >> If there isn't a C standard for this is there an APR function? > > > > Hmm, I would suspect catching signals is what you want. Look at > > apr_signal.h. I think a console kill like that would be SIGTERM or > > SIGINT, or similar. > > The constants for signals (APR_HAVE_SIGACTION, APR_HAVE_SIGWAIT, & > APR_HAVE_SIGSUSPEND) are disabled in my APR. > > This code is documented in my visual studio and I put it in my code but it > seems to do nothing. sig_handler is never called. Can you check how python handles it? I know that POSIX also has a function called atexit() which registers a function that is always called at program exit. I'm not sure if it is called when the exit value is non-zero though. -- Debian - http://www.debian.org/ Linux 1394 - http://www.linux1394.org/ Subversion - http://subversion.tigris.org/ WatchGuard - http://www.watchguard.com/