Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

Re: is libpq thread safe without configure enable_thread_safety=yes


  • From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
  • To: andrew klassen <aptklassen(at)yahoo(dot)com>
  • Cc: pgsql-interfaces(at)postgresql(dot)org
  • Subject: Re: is libpq thread safe without configure enable_thread_safety=yes
  • Date: Thu, 25 Oct 2007 19:03:22 -0300
  • Message-id: <20071025220322.GK23566@alvh.no-ip.org> <text/plain>

andrew klassen wrote:
> I want to use the libpq in a multithreaded process. I intend to use two 
>   different connections for two different threads. The requests and results 
>   for each connection will be handled completely by each thread independently. 
>   I tried to set enable_thread_safety and enable_thread_safety_force to yes.
>   However, the compile fails because of references to pthread routines which are not
>   supported by my os. Specifically:
>    
>   ../../../src/interfaces/libpq/libpq.so: undefined reference to `pthread_sigmask'
> ../../../src/interfaces/libpq/libpq.so: undefined reference to `pthread_mutex_unlock'
> ../../../src/interfaces/libpq/libpq.so: undefined reference to `pthread_mutex_lock'
> ../../../src/interfaces/libpq/libpq.so: undefined reference to `sigwait'
>    
>   I can change the code to fix this, but I wondering if based on my application it is okay
>   to just configure without setting enable_thread_safety.

It is not.  libpq itself may be fine, but other libraries it calls to
are likely not, which is why certain operations are locked.

Your pthread support is rather pathetic if it can't do
pthread_mutex_lock anyway ...

-- 
Alvaro Herrera                         http://www.flickr.com/photos/alvherre/
"I call it GNU/Linux. Except the GNU/ is silent." (Ben Reiter)



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group