AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2015.01.01 20:24 "Re: [Tiff] Fast TIFF Reading on Windows", by Aaron Boxer
[...]
2015.01.07 10:53 "Re: [Tiff] Fast TIFF Reading on Windows", by Roger Leigh
2015.01.07 15:26 "Re: [Tiff] Fast TIFF Reading on Windows", by Bob Friesenhahn
[...]

2015.01.07 15:26 "Re: [Tiff] Fast TIFF Reading on Windows", by Bob Friesenhahn

The major annoyance is the use of a global error handler which precludes the multiple callers being able to accurately report errors. I know the use of a mutex is a bit of a blunt instrument, but it's needed to save and restore the error handler and throw exceptions correctly in the calling thread. If libtiff could make the error reporting use thread- local structures, that would avoid the need to have threads contending on a mutex or other synchronisation primitive just to get an error message. If it was also thread-safe internally that would also be a huge improvement.

It is unfortunate that the global error handler was not fixed by 4.0.X. As a work-around, you can use thread-specific storage, which is supported by both POSIX threads and WIN32. GraphicsMagick uses thread specific storage to make the libtiff error reporting thread-safe.

Bob
--
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/