apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: setjmp/longjmp vs try/throw/catch
Date Tue, 20 Jul 2004 19:44:03 GMT
At 06:54 PM 7/19/2004, Nick Kew wrote:

>I have a couple of modules using third-party libraries that require me
>to supply an "abort" function (or they'll abort by exiting).
>For example, libjpeg in my mod_jpeg.
>
>My preferred approach to this situation is usually to resort to C++,
>put my code in a try/catch loop, and provide an abort handler that
>throws an exception.  However, this doesn't play well with Apache,
>and when I run it in gdb, the throw appears to generate an Abort.
>
>Switching to setjmp/longjmp does appear to work well with apache and gcc.
>But that leaves me wondering if I need to worry about thread-safety.
>Is using setjmp/longjmp with Worker or Windoze MPM asking for trouble?
>And if so, is there an alternative approach I could try?

IIRC - all setjmp and other usually-thread-agnostic calls in a normal clib
were redesigned to use TLS in the Win32 msvcrt lib, long before most
Unixes considered implementing threads :)  I believe on win32 you will
be fine, I'd be more worried about the thread implementations.

This sure sounds like an abstraction we should assist with using apr.

Bill 


Mime
View raw message