However, we really have two types of function tested. The first, strerror, can be thread safe by using thread-local storageYou are completely ignoring that libpq is a library: what if the app itself wants to call gethostbyname or stderror, too?
_or_ by returning pointers to static strings. The other two function
tests require thread-local storage to be thread-safe.
Right now libpq has it's own private mutex. This doesn't work - the locking must be process-wide. The current implementation could be the default, and apps that want to use gethostbyname [or kerberos authentication, etc.] outside libpq must fill in appropriate callbacks.
-- Manfred
---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend