Re: [INTERFACES] Inter-process communication

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Steven Bradley <sbradley(at)llnl(dot)gov>
Cc: pgsql-interfaces(at)postgreSQL(dot)org
Subject: Re: [INTERFACES] Inter-process communication
Date: 1999-06-26 17:38:00
Message-ID: 26292.930418680@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Steven Bradley <sbradley(at)llnl(dot)gov> writes:
> Instead, I would rather use the "more efficient select(2)" method alluded
> to in the Postgres documentation (and code above). Does anyone have
> sample code that uses this method to wait for a backend notification to
> arrive?

I have tried to come up with a reasonable self-contained example of
waiting for Postgres input with select(), but have not had much luck.
The trouble is that in any realistic scenario, you are not only waiting
for Postgres but also for other events that might come along, so the
select() is not waiting on just the Postgres input socket but also
other ones (your X server input socket, perhaps). So in reality the
select has to be embedded in your application's outer event loop.
It's difficult to make a plausible toy example, and even more difficult
to provide code that you might be able to just drop into whatever your
outer loop currently looks like.

If you really do want to just wait for Postgres input, you could
use the pqWait() routine in libpq's fe-misc.c.

regards, tom lane

Browse pgsql-interfaces by date

  From Date Subject
Next Message Wayne 1999-06-26 20:54:52 Documentation for pgaccess
Previous Message Daren Sefcik 1999-06-26 16:27:40 Help with ODBC and Solaris