Re: libpq thread safety

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Manfred Spraul <manfred(at)colorfullife(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: libpq thread safety
Date: 2004-01-11 19:32:07
Message-ID: 17921.1073849527@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Manfred Spraul <manfred(at)colorfullife(dot)com> writes:
> I'd agree - convince Bruce and I'll replace the mutexes in thread.c with
> #error.

Most of what I said before was aimed at Bruce ;-)

> But I think libpq should support a mutex around kerberos (or at
> least fail at runtime) - right now it's too easy to corrupt the kerberos
> authentication state.

As to the first - if an app wants to support multithreaded use of
kerberos, it will have to put a mutex around uses of kerberos. But then
it can simply extend that same mutex to uses of PQconnect. This isn't
noticeably harder from the app's point of view than what you suggest, so
I don't see the value of cluttering our API for it.

As to the second - if there were a way to detect that the app was
actually using multiple threads, I'd agree with failing at runtime
in that case. But otherwise this amounts to decreeing that you can't
compile with both --enable-thread-safety and --enable-kerberos, which
seems a tad too anal-retentive for my tastes. It seems unlikely that
there'd actually be any problem with re-entrant use of kerberos, at
least compared to common libc routines like strerror.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Shachar Shemesh 2004-01-11 20:21:00 Re: OLE DB driver
Previous Message Dennis Bjorklund 2004-01-11 19:23:30 --enable-nls