pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Steven Bradley <sbradley@llnl.gov>
Cc: pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] Inter-process communication
Date: Sat, 26 Jun 1999 13:38:00 -0400
Message-ID: <26292.930418680@sss.pgh.pa.us> (raw)
In-Reply-To: <3.0.5.32.19990625172735.009266d0@poptop.llnl.gov>

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



view thread (2+ messages)

Message-ID: <26292.930418680@sss.pgh.pa.us>
Permalink:  ../26292.930418680@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/26292.930418680@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: tgl@sss.pgh.pa.us, sbradley@llnl.gov
  Subject: Re: [INTERFACES] Inter-process communication
  In-Reply-To: <26292.930418680@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox