Received: from sss.sss.pgh.pa.us (sss.pgh.pa.us [206.210.65.6]) by hub.org (8.9.3/8.9.3) with ESMTP id NAA06235 for ; Sat, 26 Jun 1999 13:39:06 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.sss.pgh.pa.us (8.9.1/8.9.1) with ESMTP id NAA26294; Sat, 26 Jun 1999 13:38:01 -0400 (EDT) To: Steven Bradley cc: pgsql-interfaces@postgreSQL.org Subject: Re: [INTERFACES] Inter-process communication In-reply-to: Your message of Fri, 25 Jun 1999 17:27:35 -0700 <3.0.5.32.19990625172735.009266d0@poptop.llnl.gov> Date: Sat, 26 Jun 1999 13:38:00 -0400 Message-ID: <26292.930418680@sss.pgh.pa.us> From: Tom Lane Steven Bradley 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