Re: setjmp/longjmp vs try/throw/catch

2004-07-20 Thread William A. Rowe, Jr.
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 



Re: setjmp/longjmp vs try/throw/catch

2004-07-20 Thread Nick Kew
On Tue, 20 Jul 2004, William A. Rowe, Jr. wrote:

 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.

I have it on credible authority (in IRC from someone I believe, after
I asked) that POSIX requires it to be thread-safe.  That's good enough
for me: tells me I don't need to advise the Client to use prefork.

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

Agreed.  But I don't have APR karma to introduce the idea there.

-- 
Nick Kew