Re: Is this valid? - Mailing list pgsql-sql

From Weiping He
Subject Re: Is this valid?
Date
Msg-id 3D5883CA.8030803@zhengmai.com.cn
Whole thread Raw
In response to Is this valid?  (Wei Weng <wweng@kencast.com>)
Responses Re: Is this valid?  (Wei Weng <wweng@kencast.com>)
List pgsql-sql
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.

regards laser




pgsql-sql by date:

Previous
From: "Wei Weng"
Date:
Subject: 答复: [SQL] Is this valid?
Next
From: "Sugandha Shah"
Date:
Subject: Function error