X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 15303D1B4E3 for ; Sat, 11 Oct 2003 09:21:17 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 31094-02 for ; Sat, 11 Oct 2003 06:20:34 -0300 (ADT) Received: from wind.ukr.net (wind.ukr.net [212.42.64.10]) by svr1.postgresql.org (Postfix) with ESMTP id 98D6FD1B4F8 for ; Sat, 11 Oct 2003 06:20:22 -0300 (ADT) Received: from 82-23.odessa.dialup.ukr.net ([212.42.82.23]) by wind.ukr.net with esmtp ID 1A8FvF-000DZL-6D for pgsql-interfaces@postgresql.org; Sat, 11 Oct 2003 12:20:25 +0300 From: Igor Shevchenko To: pgsql-interfaces@postgresql.org Subject: libpq/async notifications Date: Sat, 11 Oct 2003 12:20:25 +0300 User-Agent: KMail/1.5.2 MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200310111220.25923.igor@carcass.ath.cx> X-HOSTING.UKR.NET-ID: d9dcda71e096772cda3fba88c9836426 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/23 X-Sequence-Number: 4512 Hi 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. The check function is as simple as: int PQhasNotifies(PGconn *conn) { if (!conn) return NULL; /* Parse any available data to see if we can extract NOTIFY messages*/ parseInput(conn); return NULL != DLGetHead(conn->notifyList); } -- Best regards, Igor Shevchenko