Received: from hipernet.com.br (nautilus.hipernet.com.br [200.246.90.107]) by hub.org (8.9.3/8.9.3) with ESMTP id HAA08982 for ; Mon, 29 Nov 1999 07:20:33 -0500 (EST) (envelope-from roberto@mha.com.br) Received: from pc35.mha.com.br ([200.230.11.197]) by hipernet.com.br (8.9.3/8.9.3) with SMTP id KAA04241 for ; Mon, 29 Nov 1999 10:21:44 -0200 (EDT) Message-Id: <3.0.5.32.19991129101959.007a1490@pop.hipernet.com.br> X-Sender: roberto@pop.hipernet.com.br (Unverified) X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.5 (32) Date: Mon, 29 Nov 1999 10:19:59 -0200 To: pgsql-interfaces@postgreSQL.org From: Roberto Joao Lopes Garcia Subject: Re: [INTERFACES] libpq + multiple connections ... In-Reply-To: <3274332053.943872169@pc452.cl.pwf.cam.ac.uk> References: <13255.943861512@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" >> 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