X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id AF09E9DCB81 for ; Tue, 28 Feb 2006 11:09:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43042-06 for ; Tue, 28 Feb 2006 11:09:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx1.surnet.cl (mx1.surnet.cl [216.155.73.180]) by postgresql.org (Postfix) with ESMTP id 2E04E9DCB9E for ; Tue, 28 Feb 2006 11:09:46 -0400 (AST) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx1.surnet.cl with ESMTP; 28 Feb 2006 12:32:18 -0300 X-IronPort-AV: i="4.02,153,1139194800"; d="scan'208"; a="42441648:sNHT19325372" Received: from alvh.no-ip.org (201.221.201.58) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 43A978FD0088C91C; Tue, 28 Feb 2006 12:09:50 -0300 Received: by alvh.no-ip.org (Postfix, from userid 1000) id 91C07C44B6F; Tue, 28 Feb 2006 12:09:50 -0300 (CLST) Date: Tue, 28 Feb 2006 12:09:50 -0300 From: Alvaro Herrera To: Robert Gruszka Cc: pgsql-interfaces@postgresql.org Subject: Re: multiple threads using one connection Message-ID: <20060228150950.GC6343@surnet.cl> Mail-Followup-To: Robert Gruszka , pgsql-interfaces@postgresql.org References: <440443A2.5080907@power.com.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <440443A2.5080907@power.com.pl> User-Agent: Mutt/1.5.11+cvs20060126 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.572 required=5 tests=[AWL=-0.347, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] X-Spam-Score: 1.572 X-Spam-Level: * X-Archive-Number: 200602/86 X-Sequence-Number: 6050 Robert Gruszka wrote: > Hi, > > I have multi-thread application written in Ada which uses APQ. All > threads use the same connection (can't afford one connection per > thread). I compiled libpq with --enable-thread-safty option. > When two threads try to execute a query at the same time one of them is > blocked and even when the other one finishes it is not unblocked. The libpq API is not really intended to be used by multiple threads simultaneously (unless you make sure only one thread is submitting a query and waiting for the result at any time). The --enable-thread-safety flag is merely to ensure that the calls to other libraries (Kerberos, etc) are handled in a thread-safe manner. It doesn't have any effect on the thread safety of the libpq API itself. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support