Re: Multi-threaded client apps

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Gunkel, Marc B" <mgunke(at)sandia(dot)gov>
Cc: "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Multi-threaded client apps
Date: 2001-02-12 21:19:31
Message-ID: 21900.982012771@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

"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

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Ken Corey 2001-02-13 02:21:57 My apologies...
Previous Message Tom Lane 2001-02-12 21:14:12 Re: Mac OS X Beta Status?