From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#50043: 28.0.50; USABLE_SIGOI undef code paths do not work correctly Date: Tue, 16 Nov 2021 19:44:56 +0200 Message-ID: <837dd80zc7.fsf@gnu.org> References: <874kbtfthj.fsf@gnus.org> <835yw9cwoa.fsf@gnu.org> <87mtpla013.fsf@gnus.org> <83zgtlbaw6.fsf@gnu.org> <87fsvcuttw.fsf@gnus.org> <83czn12uz1.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14326"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, 50043@debbugs.gnu.org To: Ken Brown Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 16 18:46:10 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mn2X4-0003SD-F4 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 16 Nov 2021 18:46:10 +0100 Original-Received: from localhost ([::1]:46038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mn2X3-0003xI-0v for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 16 Nov 2021 12:46:09 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44304) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mn2Wv-0003wt-Ul for bug-gnu-emacs@gnu.org; Tue, 16 Nov 2021 12:46:01 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47503) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mn2Wv-0006zK-MA for bug-gnu-emacs@gnu.org; Tue, 16 Nov 2021 12:46:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mn2Wv-000120-Kk for bug-gnu-emacs@gnu.org; Tue, 16 Nov 2021 12:46:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Nov 2021 17:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50043 X-GNU-PR-Package: emacs Original-Received: via spool by 50043-submit@debbugs.gnu.org id=B50043.16370847113843 (code B ref 50043); Tue, 16 Nov 2021 17:46:01 +0000 Original-Received: (at 50043) by debbugs.gnu.org; 16 Nov 2021 17:45:11 +0000 Original-Received: from localhost ([127.0.0.1]:59049 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mn2W7-0000zr-EN for submit@debbugs.gnu.org; Tue, 16 Nov 2021 12:45:11 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:43304) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mn2W5-0000zT-NV for 50043@debbugs.gnu.org; Tue, 16 Nov 2021 12:45:10 -0500 Original-Received: from [2001:470:142:3::e] (port=56704 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mn2W0-0006kY-5g; Tue, 16 Nov 2021 12:45:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=8ztrSTeIVQ2JvBQW3yqSw1LwqyNAAPVOFj6scCdjN/U=; b=QX72VhR9bYis 4blKciRbyBgthsBJD2qDPok69SKcNOCYIDKzO9CqHpnjrEzmzgnkfONVEljUwJZ7HrQk9q1/w9lgp AqQ6yvz+4FLenq74wwuUg1Tj0udHIQl2X2LvPRlIEk+s3Tp1JJm6/kXuZ771TlND7XqZT5a7vC52Q jac8nOuAEEX6GzPBrhRIaM0LgUatBaOf4DdArTTtaiuNeAME4FVxRFNwHXQzG9/BbYCCamWCiFbEz Fq2zl69IhRsPGacFkl3D+JXJCxqu3j+1dh7+BV7n/elPxTZuBRbptUOHzNxYfYINI7MNKi6kJknjH Q6pN5sDNWvalr4L2BslADA==; Original-Received: from [87.69.77.57] (port=1239 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mn2Vz-0004Cd-PO; Tue, 16 Nov 2021 12:45:04 -0500 In-Reply-To: (message from Ken Brown on Mon, 15 Nov 2021 14:26:08 -0500) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:220137 Archived-At: > Date: Mon, 15 Nov 2021 14:26:08 -0500 > Cc: larsi@gnus.org, 50043@debbugs.gnu.org > From: Ken Brown > > >> I think wait_reading_process_output gets stuck for 2 seconds in a call to select > >> (actually xg_select because I'm testing a gtk build). This is independent of > >> the fact that x-selection-timeout is 2 seconds; it happens even if > >> x-selection-timeout is 0. select returns after 2 seconds because the poll_timer > >> fires. > > > > Sorry, I don't understand: select waits for up to 2 seconds because > > that's what we ask it to do, and those 2 sec do come from > > x-selection-timeout. If x-selection-timeout is zero, select is not > > supposed to wait at all, so why does it? What am I missing? > > Setting x-selection-timeout to zero actually makes the timeout infinite: Ah, I thought you meant a literally zero timeout, not the "zero means infinite" one. > > Anyway, AFAIU, the wait is supposed to end because XTread_socket reads > > a SelectionNotify event, and that modifies the cell for which we > > wait. What I'm not sure I understand is how are we supposed to call > > XTread_socket when we are stuck inside select all the time? > > We're never stuck for more than 2 seconds [when there's no SIGIO] because > poll_timer fires and either sends SIGALRM or makes timerfd read ready. Either > way, select returns, and the next iteration of the main loop checks for input > and checks for a cell change. > > >> We certainly don't want to always skip the select call, but would it make sense > >> to use a very short timeout for select in that case? Or maybe someone has a > >> better idea. > > > > Making timeout shorter might be the solution, but I'd like to > > understand the problem better first. If the code is based on the premise that we check for selection when we exit select, then I think on systems without USABLE_SIGIO we should call wait_reading_process_output with a short timeout but in a loop, so that the summary wait is still 2 sec, but we exit the loop as soon as selection arrives because each call to wait_reading_process_output has a much shorter timeout, say, 25 msec. WDYT?