2007.08.09 12:07 "[Tiff] Error handling & threading", by John Aldridge

2007.08.09 14:30 "Re: [Tiff] Error handling & threading", by Frank Warmerdam

In a multi-threaded application, it can be a nuisance that the handlers set by TIFFSetErrorHandler[Ext] & TIFFSetWarningHandler[Ext] are static variables.

Would there be any sympathy for adding a pair of such handler function pointers to the TIFF structure? I suppose we'd need to add new versions of the

   TIFFOpen, TIFFOpenW, TIFFFdOpen, TIFFClientOpen

functions which takes such function pointers as arguments and fill them into the returned TIFF structure. The existing open functions could just default them to the current TIFFErrorExt and TIFFWarningExt functions.

Then all calls to TIFFErrorExt and TIFFWarningExt in the library could be replaced by one of

    tiff->tif_errorProc (...)
    tiff->tif_warningProc (...)

These changes would allow applications to establish per-TIFF strcture error policy without upsetting existing code.


Adding new versions of the open functions isn't all that appealing, though I *think* only a variation of TIFFClientOpen would be strictly required. I do think this is a reasonable idea, but I am also concerned that some TIFF errors may be issued from low levels where a TIFF structure is not available.

Of course, it would also likely mean touching quite a bit of code...

Best regards,

I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam

and watch the world go round - Rush    | President OSGeo, http://osgeo.org