Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m36K5-0002hh-AQ for pgsql-committers@arkaria.postgresql.org; Tue, 13 Jul 2021 00:30:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m36K4-0004D0-As for pgsql-committers@arkaria.postgresql.org; Tue, 13 Jul 2021 00:30:52 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m36K4-0004Cs-5W for pgsql-committers@lists.postgresql.org; Tue, 13 Jul 2021 00:30:52 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m36K1-0004kP-8y; Tue, 13 Jul 2021 00:30:51 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 16D0UmVY3187589; Mon, 12 Jul 2021 20:30:48 -0400 From: Tom Lane To: Thomas Munro cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Add PSQL_WATCH_PAGER for psql's \watch command. In-reply-to: References: Comments: In-reply-to Thomas Munro message dated "Mon, 12 Jul 2021 23:53:32 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3187587.1626136248.1@sss.pgh.pa.us> Date: Mon, 12 Jul 2021 20:30:48 -0400 Message-ID: <3187588.1626136248@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Thomas Munro writes: > To make \watch react quickly when the user quits the pager or presses > ^C, and also to increase the accuracy of its timing and decrease the > rate of useless context switches, change the main loop of the \watch > command to use sigwait() rather than a sleeping/polling loop, on Unix. I think this is going to fall over on gaur, which doesn't have POSIX-style sigwait. We've escaped dealing with that so far because our only existing use of sigwait is hidden under #if defined(ENABLE_THREAD_SAFETY) && !defined(WIN32) Perhaps the easiest answer is to make the #if conditional for this code look like that too. regards, tom lane