![]() |
Home
| Calendar
| Mail Lists
| List Archives
| Desktop SIG
| Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU |
Frank Ramsay writes: > I'm trying to write a signal handler that will convert the signal into > a C++ style exception, but ... > So here is my questions; > Is it possible to do this in a safe consistant maner? > And what am I doing wrong? I've worked with some code in the past that did exactly this. My advice to you: avoid this if possible. The code that I worked with a few years ago worked because it happened to be developed and run on a Solaris machine using Sun's compiler (note: I didn't write this code). It was my experience that when I ported such code over to other platforms, that this technique didn't port very easily. Sun's compiler and runtime (C++ runtime, OS signal-handling semantics) worked in concert to make this feature work nicely. But other platforms basically blew up when they encountered this. So, again, I would avoid this technique ***. > std::cout << "catch: " << except << std::endl; Another thing: you might want to consider avoiding use of the iostreams library in multi-threaded programs, unless your iostreams library provides some sort of locking functionality and your program uses this. Otherwise you can end up with interleaved garbage. Regards, --kevin *** However, one of the goals of Linux's new NPTL is C++ compatability, and I am led to believe that NPTL will have better support for this sort of functionality. If you happened to be targetting machines that utilized this library, you might be OK. Maybe. You'd need to investigate this. Oh, and make sure you're using the correct compiler too. -- "I don't know what was wrong with my program, but I put in a call to java.lang.Thread.yield() and it fixed it!" -- clownboy