is libpq thread-safe?

Поиск
Список
Период
Сортировка
Искать

is libpq thread-safe?

От:
npat@kmp.forthnet.gr
Дата:
A staight forward question:

   Is "libpq" thread-safe??

And an elaboration:

   I want to write a server that opens-up a number of connections 
   to a PostgreSQL database, and then spawns threads handing a connection
   object (PGconn) to each thread, so that all the threads can
   perform data-base operations (queries) simultaneously. Each thread will
   use its own connection object. Will this work??

Tanks
npat.





Re: is libpq thread-safe?

От:
Alfred Perlstein <bright@wintelcom.net>
Дата:
* npat@kmp.forthnet.gr  [001214 13:20] wrote:
> A staight forward question:
> 
>    Is "libpq" thread-safe??
> 
> And an elaboration:
> 
>    I want to write a server that opens-up a number of connections 
>    to a PostgreSQL database, and then spawns threads handing a connection
>    object (PGconn) to each thread, so that all the threads can
>    perform data-base operations (queries) simultaneously. Each thread will
>    use its own connection object. Will this work??

These are answered in the online docs.  Libpq is threadsafe with a 
few exceptions, see the docs for functions you shouldn't call.

-- 
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
"I have the heart of a child; I keep it in a jar on my desk."
FAQ