pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rick Gregory <rgregory@gbgsoft.com>
To: Wei Weng <wweng@kencast.com>
To: pgsql-interfaces@postgresql.org
Subject: Re: Is this valid?
Date: Mon, 12 Aug 2002 20:50:13 -0400
Message-ID: <OOEEKDKLCHOOMNCMNFFAAEOMCHAA.rgregory@gbgsoft.com> (raw)
In-Reply-To: <1029194773.28202.1.camel@Monet>

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




view thread (2+ messages)

Message-ID: <OOEEKDKLCHOOMNCMNFFAAEOMCHAA.rgregory@gbgsoft.com>
Permalink:  ../OOEEKDKLCHOOMNCMNFFAAEOMCHAA.rgregory@gbgsoft.com/
Also on:    postgresql.org/message-id/OOEEKDKLCHOOMNCMNFFAAEOMCHAA.rgregory@gbgsoft.com

 · 

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: rgregory@gbgsoft.com, wweng@kencast.com
  Subject: Re: Is this valid?
  In-Reply-To: <OOEEKDKLCHOOMNCMNFFAAEOMCHAA.rgregory@gbgsoft.com>

* 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