Talk About Network

Google





Programming > C - C++ Learning > Re: Any Kind of...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 6 Topic 4068 of 4400
Post > Topic >>

Re: Any Kind of do_on_exit() in C or C++?

by Micah Cowan <micah@[EMAIL PROTECTED] > Mar 14, 2008 at 09:51 AM

Hal Vaughan <hal@[EMAIL PROTECTED]
> writes:

> Jeff Schwab wrote:
>
>> Hal Vaughan wrote:
>>> Is there any way to catch a kill signal and if one is sent,
>>> do some closing down routines before dying?
>> 
>> It's usually not too difficult, but is inherently somewhat
non-****table.
>>   If Boost.Test doesn't do what you need, and you're on a POSIX system,
>> try installing handlers for SIGSEGV and whatever other signals interest
>> you using the POSIX sigaction function.
>
> It's on Linux and I seriously doubt this will be used on another OS, but
it
> is possible.  I can always leave that issue up to the masochist that
wants
> to ****t the code over.

It actually doesn't need to be un****table: standard C (and, thereby,
C++) provides signal handling in <signal.h> (<csignal> in C++, natch).

On POSIX systems, however, sigaction() is often preverable to standard
C's signal() as it provides more options; but just wanted to point out
that ****table options exist. And for many cases, signal() is more than
adequate (it is still quite frequently used in many Unix programs).

-- 
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/
 




 6 Posts in Topic:
Any Kind of do_on_exit() in C or C++?
Hal Vaughan <hal@[EMAI  2008-03-13 21:56:57 
Re: Any Kind of do_on_exit() in C or C++?
Ian Collins <ian-news@  2008-03-14 11:09:02 
Re: Any Kind of do_on_exit() in C or C++?
Jeff Schwab <jeff@[EMA  2008-03-13 15:27:00 
Re: Any Kind of do_on_exit() in C or C++?
Hal Vaughan <hal@[EMAI  2008-03-13 23:26:35 
Re: Any Kind of do_on_exit() in C or C++?
Jeff Schwab <jeff@[EMA  2008-03-13 19:08:49 
Re: Any Kind of do_on_exit() in C or C++?
Micah Cowan <micah@[EM  2008-03-14 09:51:59 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Wed Jan 7 12:25:20 PST 2009.