| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Mark Morgan Lloyd <markMLl(dot)pgsql-general(at)telemetry(dot)co(dot)uk> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: libpq thread safety |
| Date: | 2012-12-27 19:02:02 |
| Message-ID: | 16851.1356634922@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Mark Morgan Lloyd <markMLl(dot)pgsql-general(at)telemetry(dot)co(dot)uk> writes:
> Do any special precautions need to be taken when PQNotifies is being
> called, to make sure that nothing else is referencing the handle?
It's pretty much the same as any other operation on a PGconn: if there
could be more than one thread touching the connection object
concurrently, you'd be well advised to add some application-level
locking.
http://www.postgresql.org/docs/9.2/static/libpq-threading.html
The lack of any such locking inside libpq is partly historical, and
partly because in many practical situations you'll need application-side
locks anyway to protect application data structures associated with the
connection.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Scott Ribe | 2012-12-27 19:33:13 | progress of long running operation |
| Previous Message | Mark Morgan Lloyd | 2012-12-27 18:42:44 | libpq thread safety |