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

2004.11.05 00:53 "Re: [Tiff] is libtiff thread-safe?", by Phillip Crews

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.

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. For compilers and platforms that support it, this can be remedied easily in tif_win32.c by adding the appropriate modifier to the definitions (e.g., for win32/VC it's __declspec(thread)).

Other than that small issue, I have had no problems running libtiff in an intensive multi-threaded environment.

- Phillip