Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id AD544475806 for ; Mon, 12 Aug 2002 20:50:31 -0400 (EDT) Received: from franklin1.gbgsoft.com (unknown [209.167.102.146]) by postgresql.org (Postfix) with SMTP id D7096475775 for ; Mon, 12 Aug 2002 20:50:30 -0400 (EDT) Received: (qmail 2641 invoked from network); 13 Aug 2002 00:51:10 -0000 Received: from unknown (HELO GBGDEV) (209.167.102.154) by 0 with SMTP; 13 Aug 2002 00:51:10 -0000 From: "Rick Gregory" To: "Wei Weng" , Subject: Re: Is this valid? Date: Mon, 12 Aug 2002 20:50:13 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 In-Reply-To: <1029194773.28202.1.camel@Monet> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/33 X-Sequence-Number: 2995 No, what you want to do is not thread safe. Only 1 thread should access a Pgconn object. See: http://www2.ca.postgresql.org/users-lounge/docs/7.0/postgres/libpq-threading .htm Rick Gregory -----Original Message----- From: pgsql-interfaces-owner@postgresql.org [mailto:pgsql-interfaces-owner@postgresql.org]On Behalf Of Wei Weng Sent: Monday, August 12, 2002 7:26 PM To: pgsql-interfaces@postgresql.org Subject: [INTERFACES] Is this valid? I am not sure if this is the right mailing list I talk to. Please let me know if I had violated any unwritten rules. :) I have a global variable PGconn* m_pgconn that is the connection handle for connecting to the postgresql database. Can I access/use the handle from multiple threads? Say I have a thread that does some insertion through this handle/database connection(m_pgconn) and also another thread that do some insertion *on the same table* through this handle(m_pgconn), will that break? Thanks -- Wei Weng Network Software Engineer KenCast Inc. ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org