pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Alvaro Herrera <alvherre@commandprompt.com>
Cc: Robert Gruszka <rgruszka@power.com.pl>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: multiple threads using one connection
Date: Tue, 28 Feb 2006 13:17:07 -0500 (EST)
Message-ID: <200602281817.k1SIH7l10966@candle.pha.pa.us> (raw)
In-Reply-To: <20060228150950.GC6343@surnet.cl>

Alvaro Herrera wrote:
> 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.

Just to clarify, libpq is thread-safe is each thread uses its own
connection object.

-- 
  Bruce Momjian   http://candle.pha.pa.us
  SRA OSS, Inc.   http://www.sraoss.com

  + If your life is a hard drive, Christ can be your backup. +



view thread (4+ messages)  latest in thread

Message-ID: <200602281817.k1SIH7l10966@candle.pha.pa.us>
Permalink:  ../200602281817.k1SIH7l10966@candle.pha.pa.us/
Also on:    postgresql.org/message-id/200602281817.k1SIH7l10966@candle.pha.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: pgman@candle.pha.pa.us, alvherre@commandprompt.com, rgruszka@power.com.pl
  Subject: Re: multiple threads using one connection
  In-Reply-To: <200602281817.k1SIH7l10966@candle.pha.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox