Mike Mascari <mascarm@mascari.com> writes:
> Can I assume that libpq as of version 7 is now thread-safe?
The SSL option seems to have a static variable, as do the Kerberos auth
methods (both 4 and 5). Not sure what the implications are for thread
safeness; you might have to serialize connection opening when using
these options.
PQoidStatus is not thread-safe (as documented, but it's deprecated
anyway). I also see a completely unnecessary static variable in
PQprint, which I shall get rid of today.
Other than that, I don't see any static variables in libpq. This is not
really the same thing as thread-safeness; in particular, if you have
multiple threads accessing the same PQconn object, it's up to you to
interlock them. But you could have multiple threads each using its own
PQconn. You could also have one thread making the queries (touching
PQconn) and then hand off PQresults to other threads for processing.
regards, tom lane