2004.11.04 18:31 "[Tiff] is libtiff thread-safe?", by James Xu

2004.11.05 00:40 "Re: [Tiff] is libtiff thread-safe?", by Bob Friesenhahn

Documenting that issue and suggesting that the callbacks contain a mutex or critical section (if thread safety is an issue) might be a good idea.

I totally fail to see the connection between the lack of TIFF * parameter in the callbacks on the one hand, and multi-threading on the other. The callbacks are

In that case I will attempt to educate you.

called in the same thread context as the call to LibTiff in which the error occured. There's no threading issue here.

There is a threading issue because the thread which experiences the error is also the one which would normally make use of the detailed error information. When the code which invoked a libtiff function returns, it needs to be able to retrieve the error information so that it can properly inform the user. That means that the libtiff warning/error callback must store the error info in some thread-specific place so that it may be retrieved once the libtiff function returns. If the functions provided a pointer to user context then the error information could simply be stored there, without any need to use an OS-specific thread-API function to support thread-specific storage.

Bob

======================================
Bob Friesenhahn
bfriesen@simple.dallas.tx.us
http://www.simplesystems.org/users/bfriesen