Re: Multi-threaded client apps - Mailing list pgsql-novice

From Tom Lane
Subject Re: Multi-threaded client apps
Date
Msg-id 21900.982012771@sss.pgh.pa.us
Whole thread Raw
In response to Multi-threaded client apps  ("Gunkel, Marc B" <mgunke@sandia.gov>)
Responses RE: Multi-threaded client apps  ("JGL" <info@designthenet.com>)
List pgsql-novice
"Gunkel, Marc B" <mgunke@sandia.gov> writes:
> Can each client thread have its own connection?

That should work.

> What happens if multiple threads share one connection? For instance, can one
> thread open a connection and another thread close it?

Not a good idea unless you provide a mutex to ensure that only one
thread manipulates the PGconn object at a time.

Basically, libpq is thread-safe (in recent releases) but not thread-aware.

            regards, tom lane

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Mac OS X Beta Status?
Next
From: Ken Corey
Date:
Subject: My apologies...