AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2006.09.22 14:20 "[Tiff] libjpeg", by Philip Watkinson
2006.09.22 14:31 "Re: [Tiff] libjpeg", by Bob Friesenhahn
2006.09.22 15:22 "Re: [Tiff] libjpeg", by Joris Van Damme
2006.09.22 16:31 "Re: [Tiff] libjpeg", by Bob Friesenhahn
2006.09.22 17:49 "RE: [Tiff] libjpeg", by Philip Watkinson
2006.09.22 17:09 "RE: [Tiff] libjpeg", by Bob Friesenhahn
2006.09.22 17:25 "Re: [Tiff] libjpeg", by Joris Van Damme
2006.09.23 00:51 "Re: [Tiff] libjpeg", by Graeme Gill
2006.09.23 01:45 "Re: [Tiff] libjpeg", by Bob Friesenhahn
2006.09.22 15:20 "Re: [Tiff] libjpeg", by Joris Van Damme
2006.09.22 16:42 "Re: [Tiff] libjpeg", by Bob Friesenhahn
2006.09.22 17:31 "Re: [Tiff] libjpeg", by Joris Van Damme
2006.09.22 18:09 "Re: [Tiff] libjpeg", by Toby Thain
2006.09.22 18:16 "Re: [Tiff] libjpeg", by Bob Friesenhahn
2006.09.22 19:21 "Re: [Tiff] libjpeg", by Joris Van Damme
2006.09.22 18:29 "Re: [Tiff] libjpeg", by Bob Friesenhahn
2006.09.22 19:18 "Re: [Tiff] libjpeg", by Joris Van Damme
2006.09.22 20:09 "Re: [Tiff] libjpeg", by Bob Friesenhahn
2006.09.22 20:21 "Re: [Tiff] libjpeg", by Joris Van Damme

2006.09.22 20:09 "Re: [Tiff] libjpeg", by Bob Friesenhahn

However, it would be quite a considerable operation. We'd need to define initialization, finalization, lock and unlock calls, and need to resolve these in every platform specific unit like tif_win32.c and the sorts.

It is not too terribly bad since it turns out that there are only two dominant thread APIs (WIN32 and POSIX).

  1. It's underkill, possibly. I can't pretend I know any gory details on the longjump stuff and need to rely on you to fill the gaps, but doing so you should consider other threads may be simultaniously using longjump stuff in completely unrelated matters. That means part of the longjump usage would be protected by some mutex (the part inside tif_jpeg and tif_ojpeg), but other parts are not or either are protected by other mutexes of their own. Is that safe?

As far as I am aware, setjmp() stores all the data it needs in the user-supplied jmp_buf buffer. Conceivably a platform could store just a handle there and there would be additional thread safety issues but that seems unlikely. The most likely issue is that the context stored by setjmp() is no longer valid, or is incomplete, when longjmp() is invoked. So I would not worry about other setjmp()/longjmp() users.

errno? Are you refering to issues specific to any particular platform, like e.g. IO calls or memory allocation calls and their error returns? Or are you refering to a specific implementation of LibTiff error handlers?

errno was just an example. I see that libtiff only uses it for ATARI even though errno is the POSIX standard way to return an error code from a system call. Another area usually effected by thread-safe compilation are the stdio APIs.

Regardless of thread safety issues, few complaints have been voiced about improper libtiff operation due to multi-threaded use. This explains why libtiff has not been enhanced to positively ensure thread safety.

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