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

2004.11.05 12:19 "Re: [Tiff] is libtiff thread-safe?", by John Aldridge

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.

Another issue is that the pointers to the error and warning handlers are shared by all threads, so different threads cannot set up different error handling routines for different uses.

How about this for solving both problems in one go...

Extend the TIFF data structure to contain a pair of function pointers to error and warning handling functions. When an error or warning occurs, see whether the relevant pointer is NULL, and if so just call the existing global function. If it's not NULL, then call the function from the TIFF structure instead, passing the TIFF* as an argument. I guess there's no need for specific user context for these functions, as the TIFFGet/SetClientInfo seems to cover it?