Re: Unixware Patch (Was: Re: Beta2 Tag'd and Bundled ...)

Lee Kindness <lkindness@csl.co.uk>

From: Lee Kindness <lkindness@csl.co.uk>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Lee Kindness <lkindness@csl.co.uk>, Greg Stark <gsstark@mit.edu>, Bruce Momjian <pgman@candle.pha.pa.us>, pgsql-hackers@postgresql.org
Date: 2003-09-02T10:49:28Z
Lists: pgsql-hackers
Lee Kindness writes:
 > Tom Lane writes:
 >  > Greg Stark <gsstark@mit.edu> writes:
 >  > > On the other hand, things like, getpwnam, strtok, etc have non-thread-safe
 >  > > APIs. They can never be made thread-safe. The *_r versions of these functions
 >  > > are standardized and required. If they don't exist then the platform simply
 >  > > does not support threads.
 >  > 
 >  > This statement is simply false.  A platform can build thread-safe
 >  > versions of those "unsafe" APIs if it makes the return values point
 >  > to thread-local storage.  Some BSDs do it that way.  Accordingly, any
 >  > simplistic "we must have _r to be thread-safe" approach is
 >  > incorrect.
 > 
 > No, it's not. Using the _r functions on such systems is BETTER because
 > the API is clean and the function can be implmented in a reentrant and
 > thread-safe fashion wuithout the need for thread local storage or
 > mutex locking.

Sorry Tom, I should have read a bit more carefully! Yeah, I agree with
your point that the lack of _r functions doesn't mean the platform is
non thread-safe!

L.