RE: Multi-threaded client apps

From: "JGL" <info(at)designthenet(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: RE: Multi-threaded client apps
Date: 2001-02-13 14:30:51
Message-ID: NDBBKHNOCKIMKLFEONMFGEGGEKAA.info@designthenet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

-----Original Message-----
From: pgsql-novice-owner(at)postgresql(dot)org
[mailto:pgsql-novice-owner(at)postgresql(dot)org]On Behalf Of Tom Lane
Sent: Monday, February 12, 2001 4:20 PM
To: Gunkel, Marc B
Cc: 'pgsql-novice(at)postgresql(dot)org'
Subject: Re: [NOVICE] Multi-threaded client apps

"Gunkel, Marc B" <mgunke(at)sandia(dot)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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message John Burski 2001-02-13 17:18:08 Re: Here you have, ;o)
Previous Message Ken Corey 2001-02-13 02:21:57 My apologies...