threads question

Lists: pgsql-novice
From: "Wright, George" <George(dot)Wright(at)infimatic(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: threads question
Date: 2008-10-08 19:28:11
Message-ID: 51548D6D5BEB57468163194A8C1A0E980161A6A4@MAGPTCPEXC02.na.mag-ias.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Can I open a connection to a PostgreSQL database from some C/C++ code
then share the connection handle with multiple threads in the C/C++
environment?

I wanted to be able to call a stored procedure from each of the threads
using a different id for each.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Wright, George" <George(dot)Wright(at)infimatic(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: threads question
Date: 2008-10-08 22:34:11
Message-ID: 551.1223505251@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

"Wright, George" <George(dot)Wright(at)infimatic(dot)com> writes:
> Can I open a connection to a PostgreSQL database from some C/C++ code
> then share the connection handle with multiple threads in the C/C++
> environment?

Sure, but it's up to you to prevent the threads from trying to do more
than one thing at a time with the connection.

regards, tom lane