Return-Path: <tiff-bounces@remotesensing.org>
Received: from inav005.isp.belgacom.be (inav005.isp.belgacom.be [195.238.2.77])
        by mailst035.isp.belgacom.be (8.12.11/8.12.11/Skynet-MAILSTORE-2.14) with ESMTP id iA5CJrZB014418
        for <joris.at.lebbeke@skynet.be>; Fri, 5 Nov 2004 13:19:53 +0100
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from inas007.isp.belgacom.be (localhost [127.0.0.1])
        by inav005.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-AV-3.00) with ESMTP id iA5CJpGZ016664
        for <joris.at.lebbeke@skynet.be>; Fri, 5 Nov 2004 13:19:51 +0100
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from inmx012.isp.belgacom.be (inmx012.isp.belgacom.be [195.238.3.90])
        by inas007.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-AS-2.03) with ESMTP id iA5CJfAH028206
        for <joris.at.lebbeke@skynet.be>; Fri, 5 Nov 2004 13:19:43 +0100
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from xserve.flids.com (adsl-065-083-169-202.sip.mco.bellsouth.net [65.83.169.202])
        by inmx012.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id iA5CJW06016850
        for <joris.at.lebbeke@skynet.be>; Fri, 5 Nov 2004 13:19:34 +0100
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from adsl-065-083-169-202.sip.mco.bellsouth.net (localhost [127.0.0.1])
	by xserve.flids.com (Postfix) with ESMTP
	id 7DE1144A767; Fri,  5 Nov 2004 07:19:19 -0500 (EST)
X-Original-To: Tiff@remotesensing.org
Delivered-To: Tiff@remotesensing.org
Received: from mailhost.informatix.co.uk (informatixdsl.claranet.co.uk
	[80.168.136.49])
	by xserve.flids.com (Postfix) with ESMTP id 1F92544A741
	for <Tiff@remotesensing.org>; Fri,  5 Nov 2004 07:19:16 -0500 (EST)
Received: from [127.0.0.1] (192.168.0.2) by mailhost.informatix.co.uk
	(Worldmail 1.3.167) for Tiff@remotesensing.org;
	5 Nov 2004 12:19:14 +0000
Message-ID: <418B6FC2.2020907@informatix.co.uk>
Date: Fri, 05 Nov 2004 12:19:14 +0000
From: John Aldridge <john.aldridge@informatix.co.uk>
User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: Tiff@remotesensing.org
Subject: Re: [Tiff] is libtiff thread-safe?
References: <LOENLAKPHCMDKNAAGBHCAEEECAAA.jxu@cvisiontech.com><Pine.SOC.4.60.0411041303330.9670@blade.simplesystems.org><6.0.0.22.1.20041104140811.02611f48@pop.earthlink.net><Pine.SOC.4.60.0411041311570.9670@blade.simplesystems.org><001101c4c2b2$c5616c40$a304f151@dfgrrxsknr4e><6.0.0.22.1.20041104161558.025fb5a0@pop.earthlink.net><Pine.SOC.4.60.0411041531590.9670@blade.simplesystems.org>	<p05210608bdb066d92f01@[153.32.48.223]>	<000f01c4c2c9$2a9f1420$3825c850@dfgrrxsknr4e>	<Pine.SOC.4.60.0411041834110.9670@blade.simplesystems.org>
	<418ACF04.7060406@cerious.com>
In-Reply-To: <418ACF04.7060406@cerious.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: 
X-BeenThere: tiff@remotesensing.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: TIFF and libtiff discussion  <tiff.remotesensing.org>
List-Unsubscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=unsubscribe>
List-Archive: <http://xserve.flids.com/pipermail/tiff>
List-Post: <mailto:tiff@remotesensing.org>
List-Help: <mailto:tiff-request@remotesensing.org?subject=help>
List-Subscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=subscribe>
Sender: tiff-bounces@remotesensing.org
Errors-To: tiff-bounces@remotesensing.org
X-UIDL: ee5bef75bc207d54d55bdf136b5a81c0

Phillip Crews wrote:
> Bob Friesenhahn wrote:

>> 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?

-- 
John
_______________________________________________
Tiff mailing list
Tiff@remotesensing.org
http://xserve.flids.com/mailman/listinfo/tiff
