X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id B8226D1B56B for ; Tue, 14 Oct 2003 16:10:53 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 22943-10 for ; Tue, 14 Oct 2003 13:10:23 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id AE01ED1B543 for ; Tue, 14 Oct 2003 13:10:22 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h9EGALhn009885; Tue, 14 Oct 2003 12:10:21 -0400 (EDT) To: Igor Shevchenko Cc: pgsql-interfaces@postgresql.org Subject: Re: libpq/async notifications In-reply-to: <200310111220.25923.igor@carcass.ath.cx> References: <200310111220.25923.igor@carcass.ath.cx> Comments: In-reply-to Igor Shevchenko message dated "Sat, 11 Oct 2003 12:20:25 +0300" Date: Tue, 14 Oct 2003 12:10:21 -0400 Message-ID: <9884.1066147821@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/29 X-Sequence-Number: 4518 Igor Shevchenko writes: > Is there a way to only check if there's any pending async notifications ? > I've found only PQnotifies(..) but it also removes the first notification from > the list. > A function for only checking this can be used in a gui app to setup async > notifications processing so it happens only after an app reaches it's main > loop (which is a good idea since it won't happen in the middle of another > app's handler function which happens to use pgsql database interface). > Currently I have to check for notifications with PQnotifies every time my app > returns to the main loop after using any of PGexec, etc, which is not very > efficient. "Not very efficient"? This seems like a very weak argument. The actual cost of running the function is no different from PQnotifies in the case where no notify event is found; and in the case where one is found, it'd be slower because you'd then have to call PQnotifies anyway to remove the item from the list. Yes, I know the function is only five lines, but there are also documentation and other maintenance costs to consider anytime we add something to libpq's API. I don't think you've made enough of a case for it. regards, tom lane