I'm writing a jpeg module, using libjpeg to implement cjpeg/djpeg filters.

Looking at error handling, I find that libjpeg by default exits on
fatal error.  This can be overridden with a setjmp/longjmp construct.

However, I seriously doubt setjmp/longjmp is safe with threaded MPMs,
and there's no apr_setjmp.  So that's not an attractive option.

It seems that other libraries inherit this behaviour.  For example,
gd does both the above, and is harder to override than libjpeg,
so that doesn't help.

An alternative might be to use C++ try/catch, with a throw()
in the fatal-error handler.  This seems to offer the compiler
more scope for generating thread-safe code than setjmp/longjmp,
but I really don't know if that's wishful thinking ...

Where do I stand using either setjmp/longjmp or try/throw/catch
with different MPMs?


-- 
Nick Kew

Nick's manifesto: http://www.htmlhelp.com/~nick/

Reply via email to