Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id A39E09F9FDB for ; Thu, 25 Oct 2007 19:03:34 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 94458-01 for ; Thu, 25 Oct 2007 19:03:16 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from lists.commandprompt.com (host-254.commandprompt.net [207.173.203.254]) by postgresql.org (Postfix) with ESMTP id 11DF19F9F81 for ; Thu, 25 Oct 2007 19:03:24 -0300 (ADT) Received: from perhan.alvh.no-ip.org (201-221-193-165.bk11-dsl.surnet.cl [201.221.193.165]) (authenticated bits=0) by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id l9PM3OQg024031; Thu, 25 Oct 2007 15:03:25 -0700 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id E9AED47C79; Thu, 25 Oct 2007 19:03:22 -0300 (CLST) Date: Thu, 25 Oct 2007 19:03:22 -0300 From: Alvaro Herrera To: andrew klassen Cc: pgsql-interfaces@postgresql.org Subject: Re: is libpq thread safe without configure enable_thread_safety=yes Message-ID: <20071025220322.GK23566@alvh.no-ip.org> References: <731502.39043.qm@web37301.mail.mud.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <731502.39043.qm@web37301.mail.mud.yahoo.com> User-Agent: Mutt/1.5.16 (2007-06-11) X-Virus-Scanned: ClamAV 0.91.1/4593/Thu Oct 25 00:03:02 2007 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (lists.commandprompt.com [192.168.2.159]); Thu, 25 Oct 2007 15:03:27 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/12 X-Sequence-Number: 6639 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)