Re: [INTERFACES] Inter-process communication

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [INTERFACES] Inter-process communication
Дата
Msg-id 26292.930418680@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Inter-process communication  (Steven Bradley <sbradley@llnl.gov>)
Список 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 по дате отправления:

Предыдущее
От: Rick Sipe
Дата:
Сообщение: unsubscribe
Следующее
От: "Stan Brown"
Дата:
Сообщение: ODBC info?