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

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Lee Kindness <lkindness(at)csl(dot)co(dot)uk>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Greg Stark <gsstark(at)mit(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Unixware Patch (Was: Re: Beta2 Tag'd and Bundled ...)
Date: 2003-09-02 15:21:27
Message-ID: 200309021521.h82FLRx12245@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Lee Kindness wrote:
> Tom Lane writes:
> > Greg Stark <gsstark(at)mit(dot)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.

I don't care about overhead at this point. These functions are rarely
called.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Czuczy Gergely 2003-09-02 15:21:35 Re: C++ and libpq
Previous Message Bruce Momjian 2003-09-02 15:20:14 Re: Unixware Patch (Was: Re: Beta2 Tag'd and Bundled ...)