converting a signal to a C++ exception

I am trying to imitate a system call available on Win32
(spit). The functionality is to catch a system exception (i.e. signal)
such as divide-by-zero, and convert it to a catchable c++
exception. Can this be done on Unix ?
Can i use "throw new <ExcpetionClass>" inside a
signal-handling routine ?
I am using AIX.
Thank you for your time

Seeker

Have you tried it ?

I will post a message here if I have any advances

If you set up one handler for each, you will get this to work under Linux.

#include <iostream.h>
#include <stdlib.h>
#include <signal.h>

class sx {
public:
sx(int sig) {
cout << "Signal " << sig << " caught\n";
}
};

void handler(int s)
{
cout << "yes, I'm here\n";
new sx(s);
exit(0);
}

main(int ac, char *av[])
{
signal(SIGINT, handler);
for (;;);
}

Press Ctl-C, and you will get two messages, the signal number is random, because of the this pointer.

Atle