From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#25214: 26.0.50; Interacting with user from threads other than the primary Date: Mon, 17 Sep 2018 22:11:52 +0300 Message-ID: <83efdsgcqv.fsf@gnu.org> References: <837f6z9a4x.fsf@gnu.org> <87zhwguskw.fsf@gmx.de> <83fty8ge50.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1537212095 18428 195.159.176.226 (17 Sep 2018 19:21:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 17 Sep 2018 19:21:35 +0000 (UTC) Cc: 25214@debbugs.gnu.org, tom@tromey.com To: michael.albinus@gmx.de Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 17 21:21:31 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1z5P-0004fx-7o for geb-bug-gnu-emacs@m.gmane.org; Mon, 17 Sep 2018 21:21:31 +0200 Original-Received: from localhost ([::1]:37098 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1z7V-00013z-OU for geb-bug-gnu-emacs@m.gmane.org; Mon, 17 Sep 2018 15:23:41 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1z7G-0000hc-9X for bug-gnu-emacs@gnu.org; Mon, 17 Sep 2018 15:23:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1yxC-0000E3-7F for bug-gnu-emacs@gnu.org; Mon, 17 Sep 2018 15:13:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39110) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g1yxC-0000Dp-0k for bug-gnu-emacs@gnu.org; Mon, 17 Sep 2018 15:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1g1yxB-00053d-Rp for bug-gnu-emacs@gnu.org; Mon, 17 Sep 2018 15:13:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 17 Sep 2018 19:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25214 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25214-submit@debbugs.gnu.org id=B25214.153721154919394 (code B ref 25214); Mon, 17 Sep 2018 19:13:01 +0000 Original-Received: (at 25214) by debbugs.gnu.org; 17 Sep 2018 19:12:29 +0000 Original-Received: from localhost ([127.0.0.1]:43368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1ywd-00052h-6O for submit@debbugs.gnu.org; Mon, 17 Sep 2018 15:12:27 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:57388) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1ywc-00052W-37 for 25214@debbugs.gnu.org; Mon, 17 Sep 2018 15:12:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1ywS-0007E1-11 for 25214@debbugs.gnu.org; Mon, 17 Sep 2018 15:12:20 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:56125) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1yw9-0006Z2-6w; Mon, 17 Sep 2018 15:11:58 -0400 Original-Received: from [176.228.60.248] (port=2309 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1g1yw8-0004rb-NH; Mon, 17 Sep 2018 15:11:57 -0400 In-reply-to: <83fty8ge50.fsf@gnu.org> (message from Eli Zaretskii on Mon, 17 Sep 2018 21:41:47 +0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:150380 Archived-At: > Date: Mon, 17 Sep 2018 21:41:47 +0300 > From: Eli Zaretskii > Cc: 25214@debbugs.gnu.org, tom@tromey.com > > So what means do we have to interrupt a pselect call from another > thread? One simple idea is not to interrupt a pselect call, but instead to make sure the main thread never waits for too long for pselect to return. We could arrange for acquire_global_lock to maintain a count of the number of threads that are waiting to take the lock, and if that number is positive, reduce the timeout we pass to pselect such that it never waits for more than, say, 1 sec. Then we need a way for a non-main thread to wait until the main thread returns from pselect, at which time the non-main thread could proceed with its own attempt to read input, while the main thread is stuck waiting for the global lock.