This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: converting signals to C++ exceptions
- From: Gokhan Kisacikoglu <kisa at centropolisfx dot com>
- To: Alexy Khrabrov <alexy dot khrabrov at setup dot org>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 22 Jul 2002 15:38:58 -0700
- Subject: Re: converting signals to C++ exceptions
- Organization: Centropolis Effects, LLC
- References: <200207222101.g6ML1dq14504@angle.badbox.com>
- Reply-to: kisa at centropolisfx dot com
I am not sure this can be done. Unix signals are handled by service
functions that you install prior, they are invoked regardless the state
of your program (even though it is more than likely that your program is
causing the signal other than few system resource problems). So, once
the signal is handled by your handler function, it will not return where
your program was left off, the handler function decides on what to do
next -most of the time your program is expected to exit anyway. Hence,
it is probably not possible to apply a catch method, because the unix OS
would not know which catch to call when your handler function returns
-there can be several instances in the memory that could handle-, but
you can call the same clean up functions that you would call at the
catch construct from the handler function -basically, you just need to
keep few globals around to find out the leaking data or the data to be
recovered...
HTH,
Gokhan
Alexy Khrabrov wrote:
>
> Is there a reasonable way to convert Unix signals
> to C++ exceptions on Linux with g++?
>
> Cheers,
> Alexy