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

Re: [INTERFACES] libpq + multiple connections ...

From: Roberto Joao Lopes Garcia <roberto(at)mha(dot)com(dot)br>
To: pgsql-interfaces(at)postgreSQL(dot)org
Subject: Re: [INTERFACES] libpq + multiple connections ...
Date: 1999-11-29 12:19:59
Message-ID: (view raw or whole thread)
Lists: pgsql-interfaces
>> 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) {
   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


In response to


pgsql-interfaces by date

Next:From: Enrique Rodriguez LazaroDate: 1999-11-29 12:45:07
Subject: Problems whit insert from psql
Previous:From: Bill BarnesDate: 1999-11-29 10:59:48
Subject: pgaccess on win95 connection

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group