Re: [INTERFACES] Inter-process communication - Mailing list pgsql-interfaces

From Tom Lane
Subject Re: [INTERFACES] Inter-process communication
Date
Msg-id 26292.930418680@sss.pgh.pa.us
Whole thread Raw
In response to Inter-process communication  (Steven Bradley <sbradley@llnl.gov>)
List pgsql-interfaces
Steven Bradley <sbradley@llnl.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


pgsql-interfaces by date:

Previous
From: Rick Sipe
Date:
Subject: unsubscribe
Next
From: "Stan Brown"
Date:
Subject: ODBC info?