From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject:
Date: 2003-07-22 14:55:55
Message-ID: Pine.LNX.4.56.0307221652200.955@krusty.credativ.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I've been thinking some about how exactly to provide the new option of
thread-safe clients (libpq, ecpg). Let me state the following goals:

a. Thread-safeness, where it makes a difference, is generally thought to
be a performance hit, so the user needs to have a choice to use
thread-safe libraries or not.

b. The user needs to be able to make the choice at the time he builds his
application, *not* at the time the PostgreSQL distribution is built or
installed.

Clearly, a thread-safe ecpg library is always going to be significantly
different from the "normal" one, with all the mutex things that get pulled
in, so it seems reasonable to always offer a libecpg_r alongside the
libecpg.

The question is whether a libpq_r should be provided if libpq is
thread-safe by default (no *_r functions, libc_r, or special flags). I
think yes. It could be a symlink, so it doesn't really waste space. But
it would convenience users: Those who want to be sure to always link
against a thread-safe version can point to libpq_r and don't have to
create complicated detection mechanisms. Those who know that their system
is thread-safe by default can simply use libpq to follow that convention.
And of course it creates consistency with libecpg_r and does not bother
the user with complicated internal artifacts.

A final note on the name of the configure option, --with-threads. First,
it does not control an external package but an internal feature, so it
should be --enable-. Secondly, it does not use threads, only enable
thread-safeness. So --enable-thread-safe might be a better name. Or if
you want to be more precise, --enable-thread-safe-client. The latter is
what MySQL uses, in case anyone cares about that.

--
Peter Eisentraut peter_e(at)gmx(dot)net

Responses

  • Re: at 2003-07-22 15:11:33 from Tom Lane
  • Re: at 2003-07-22 15:27:45 from Shridhar Daithankar
  • Re: at 2003-07-22 18:31:58 from Bruce Momjian
  • Re: at 2003-07-23 17:26:42 from Bruce Momjian

Browse pgsql-hackers by date

  From Date Subject
Next Message Nigel J. Andrews 2003-07-22 15:10:01 Re: tsearch2 for 7.3.X
Previous Message Tom Lane 2003-07-22 14:39:38 Re: PATCH: Memory leaks on start-up