Re: PostgreSQL libraries - PThread Support, but not use...

From: Lee Kindness <lkindness(at)csl(dot)co(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Cc: lkindness(at)csl(dot)co(dot)uk
Subject: Re: PostgreSQL libraries - PThread Support, but not use...
Date: 2003-01-09 14:14:21
Message-ID: 15901.33725.431183.286372@kelvin.csl.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Guys, just posted patches for libpq to address thread-safe issues. Now
uses strerror_r(), gethostbyname_r(), getpwuid_r() and crypt_r() where
available. Passes all tests on Linux and Solaris.

Any comments let me know - my first major(ish) outing in the
PostgreSQL source, in particular I'm not use in the configure stuff is
100% right...

Patches also at:

http://services.csl.co.uk/postgresql/diffs-20030109-configure.txt.gz
http://services.csl.co.uk/postgresql/diffs-20030109-libpq.txt.gz

Thanks, Lee.

Lee Kindness writes:
> Tom Lane writes:
> > Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > > We have definatly had requests for improved thread-safeness for libpq
> > > and ecpg in the past, so whatever you can do would be a help. We say
> > > libpq is thread-safe, but specifically mention the non-threadsafe calls
> > > in the libpq documentation, or at least we should.
> > We do:
> > http://www.ca.postgresql.org/users-lounge/docs/7.3/postgres/libpq-threading.html
> > But Lee's point about depending on possibly-unsafe libc routines is a
> > good one. I don't think anyone's gone through the code with an eye to
> > that.
>
> Right, so a reasonable angle for me to take is to go through the libpq
> source looking for potential problem areas and use of "known bad"
> functions. I can add autoconf checks for the replacement *_r()
> functions, and use these in place of the traditional ones where
> available.
>
> If any function is found to be not thread-safe and cannot be made so
> using standard library calls then it needs to be documented as such
> both in the source and the aforementioned documentation.
>
> This approach avoids any thread library dependencies and documents the
> current state of play WRT thread safety (i.e it's a good, and needed,
> basis for any later work).
>
> ECPG is a separate issue, and best handled as such (it will need
> thread calls). I'll post a patch for it at a later date so the changes
> are available to anyone who wants to play with ECPG and threads.
>
> Ta, Lee.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Treat 2003-01-09 14:15:34 Re: psql and readline
Previous Message Lee Kindness 2003-01-09 14:08:51 Re: [HACKERS] PostgreSQL libraries - PThread Support, but not use...

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-01-09 15:04:14 Re: [HACKERS] PostgreSQL libraries - PThread Support, but not use...
Previous Message Lee Kindness 2003-01-09 14:08:51 Re: [HACKERS] PostgreSQL libraries - PThread Support, but not use...