Re: Concurrent psql patch

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, David Fetter <david(at)fetter(dot)org>, Jim Nasby <decibel(at)decibel(dot)org>, pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Concurrent psql patch
Date: 2007-05-24 20:49:53
Message-ID: 20807.1180039793@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> if (pset.c->db->asyncStatus != PGASYNC_BUSY)
> {
> break;
> }

There already is a defined API for this, namely PQisBusy().

In any case, I rather concur with the XXX comment: busy-waiting like
this sucks. The correct way to do this is to get the socket numbers for
the connections (via PQsocket), wait for any of them to be read-ready
according to select() (or for the timeout to elapse, assuming that we
think that behavior is good), then cycle through PQconsumeInput() and
PQisBusy() on each connection. See
http://www.postgresql.org/docs/8.2/static/libpq-async.html

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2007-05-24 21:00:00 Re: Concurrent psql patch
Previous Message Andrew Dunstan 2007-05-24 20:37:40 Re: Concurrent psql patch

Browse pgsql-patches by date

  From Date Subject
Next Message Andrew Dunstan 2007-05-24 21:00:00 Re: Concurrent psql patch
Previous Message Andrew Dunstan 2007-05-24 20:37:40 Re: Concurrent psql patch