pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Roberto Joao Lopes Garcia <roberto@mha.com.br>
To: pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] libpq + multiple connections ...
Date: Mon, 29 Nov 1999 10:19:59 -0200
Message-ID: <3.0.5.32.19991129101959.007a1490@pop.hipernet.com.br> (raw)
In-Reply-To: <3274332053.943872169@pc452.cl.pwf.cam.ac.uk>
References: <13255.943861512@sss.pgh.pa.us>

>> safely run two PQconnectdb() calls in parallel.  But you can open two
>> connections in sequence and then use them in parallel; 
>

So I could open, for exemple, 5 db connections (with PQconnectdb()) and
then create 5 threads and use those connections in eache thread. But how
about use PQreset() or PQfinish() inside the new created threads?

I used to test connection before send a query like bellow:

if(PQstatus(con)==CONNECTION_BAD) {
   PQreset(con);
   if(PQstatus(con)==CONNECTION_BAD) erro_fatal();
}

Should I protect the calls to those functions by an mutex?? Could it
work??? Which functions read or alter Qconnectdb()'s  static array??

I think it is important to mark wich  functions in Libpq is thread safe or
not.

Roberto





view thread (11+ messages)  latest in thread

Message-ID: <3.0.5.32.19991129101959.007a1490@pop.hipernet.com.br>
Permalink:  ../3.0.5.32.19991129101959.007a1490@pop.hipernet.com.br/
Also on:    postgresql.org/message-id/3.0.5.32.19991129101959.007a1490@pop.hipernet.com.br

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-interfaces@postgresql.org
  Cc: roberto@mha.com.br
  Subject: Re: [INTERFACES] libpq + multiple connections ...
  In-Reply-To: <3.0.5.32.19991129101959.007a1490@pop.hipernet.com.br>
  References: <13255.943861512@sss.pgh.pa.us> <3.0.5.32.19991129101959.007a1490@pop.hipernet.com.br>

* 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