tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Translate signal to C++ exception



In article <57085C5E.9080506%gmx.com@localhost>, Kamil Rytarowski  <n54%gmx.com@localhost> wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA256
>
>I'm stuck with .Net porting to NetBSD, with the need to throw C++
>exceptions from a signal handler (SIGSEGV).
>
>I have found similar use-case in gcc/libjava and freebsd (dummy?) code
>there. It was abstracted into a segvcatch library (wip/segvcatch).
>
>I'm failing to make it work on NetBSD (release 7.0). This blocks me
>from porting dotnet stack.
>
>Thank you in advance,
>
>I'm aware of the danger of this approach, for now I need to make it
>just work. I cannot rewrite the dotnet code to use atomics etc.

The java case if very limited and specialized; it won't even work
properly in all cases.

https://stackoverflow.com/questions/12410992/c-is-using-segvcatch-safe

The only right way to do this is to do all the unwinding after you 
sigreturn()/setcontext() from the signal handler (since calling free()
is illegal from a signal handler).

christos



Home | Main Index | Thread Index | Old Index