Re: Is this valid?

From: Wei Weng <wweng(at)kencast(dot)com>
To: Weiping He <laser(at)zhengmai(dot)com(dot)cn>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Is this valid?
Date: 2002-08-13 14:27:28
Message-ID: 1029248854.29893.3.camel@Monet
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mon, 2002-08-12 at 23:58, Weiping He wrote:
> Wei Weng wrote:
>
> >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
> >
> >
> >
> >
> I don't think it's a good idea to use global variable
> in multi-thread environment.
> I think use different handle in differents is better.
>
> libpq is thread safe, but it doesn't necessary mean
> that you could free of your own code.
>
Is it going to be resource draining if I make lots of connections in a
very short time?

--
Wei Weng
Network Software Engineer
KenCast Inc.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Marie G. Tuite 2002-08-13 17:29:32 Re: Delete function without knowing the elements
Previous Message Alexander M. Pravking 2002-08-13 07:37:13 Re: Conversion