From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#25214: 26.0.50; Interacting with user from threads other than the primary Date: Fri, 28 Sep 2018 13:09:12 +0200 Message-ID: <87r2hdho9z.fsf@gmx.de> References: <837f6z9a4x.fsf@gnu.org> <87zhwguskw.fsf@gmx.de> <83fty8ge50.fsf@gnu.org> <83efdsgcqv.fsf@gnu.org> <875zz3mcnu.fsf@gmx.de> <834lengq5f.fsf@gnu.org> <87o9ciapdf.fsf@gmx.de> <83o9ci7w0d.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1538132891 29250 195.159.176.226 (28 Sep 2018 11:08:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 28 Sep 2018 11:08:11 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 25214@debbugs.gnu.org, tom@tromey.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 28 13:08:06 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 1g5qcv-0007Wg-Pa for geb-bug-gnu-emacs@m.gmane.org; Fri, 28 Sep 2018 13:08:05 +0200 Original-Received: from localhost ([::1]:42735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5qf2-0003PL-GH for geb-bug-gnu-emacs@m.gmane.org; Fri, 28 Sep 2018 07:10:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46512) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5qer-0003Ox-Tt for bug-gnu-emacs@gnu.org; Fri, 28 Sep 2018 07:10:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5qeo-0004I0-L3 for bug-gnu-emacs@gnu.org; Fri, 28 Sep 2018 07:10:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52987) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g5qeo-0004FJ-GK for bug-gnu-emacs@gnu.org; Fri, 28 Sep 2018 07:10:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1g5qeo-0001ji-4y for bug-gnu-emacs@gnu.org; Fri, 28 Sep 2018 07:10:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <837f6z9a4x.fsf@gnu.org> Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 28 Sep 2018 11:10:02 +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.15381329776629 (code B ref 25214); Fri, 28 Sep 2018 11:10:02 +0000 Original-Received: (at 25214) by debbugs.gnu.org; 28 Sep 2018 11:09:37 +0000 Original-Received: from localhost ([127.0.0.1]:57245 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g5qeP-0001ir-6B for submit@debbugs.gnu.org; Fri, 28 Sep 2018 07:09:37 -0400 Original-Received: from mout.gmx.net ([212.227.15.15]:49745) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g5qeN-0001ia-9a for 25214@debbugs.gnu.org; Fri, 28 Sep 2018 07:09:35 -0400 Original-Received: from detlef.gmx.de ([178.20.94.84]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MeP5b-1gOLlD0TWh-00QDwx; Fri, 28 Sep 2018 13:09:16 +0200 Original-Received: from detlef.gmx.de ([178.20.94.84]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MeP5b-1gOLlD0TWh-00QDwx; Fri, 28 Sep 2018 13:09:16 +0200 X-Provags-ID: V03:K1:HvSZcFu6tU2ksf8CyTKez6rMObu7J6OayT5AM/j42CKNjjxsjUg VnZRaFZvoBNi/WuQPSxRtT3mrRKF0/gMxS3UNvfkEAYyWJfNiZ+0mHiDOj4rhcorz25DQ/7 AQSCckm1hG2oVUSfzqxwkTSPSTXT+ze26qf+CweAUPwnQcKOdlPFAUADPFJ9fEpcTdUmZdE 691T03+DAEzW0q/2ih+AQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:nHEokN+ykZI=:IOyxN2SYB3/VditwkjbL04 CKcFYDxb0bGhYT0evh24PEUoD4XGVfzTIK0EM2RYuuMRjXCpRSCJ0PKv1OFzb8L9BY8UEA9Kx 8a650r43E983ZXycWIjFESwo6uwz4iiAvSn4hDBytiVGMvaJjVpRLqVRZSeb7dOcYSPlfkkI6 dvaS1u1Rw+PTrxHhKH+pFacIdLeX2qVuI97ubjBAxtpy3qbaWWBGWQo+RvNpTH8fvKkbW7AJK /ihXkbwJtVSxuqWSdvqAUMB28q0kKHpH0JB+vAN7qjUmB/xn8tROms5F7RwpEur77egQN9a7U Q3oWDPka34xXjLYcMJdTjiQAK/4BkAXOIWwddgv3PzZx2vY6/BH42jljGUqTKW86EMqGZfh4z HGJ1cy7Q+0XGp75CcErZNeMaNCwRagyL5JYDgEye3T8m2JeEIgo5iPcudfLo455c4W8jv0Ygm UnILPoSqoilirP3E/5L9ybbQB6NMXx1vOJnVSNIL61PWKmMYLEEe19pvBCTBfvRyqcQY7qiXT /9Mvpap8OB6CziYZNboRJtfNab+2WmI3/9Myf6LlbcdE6xrgqRZi3O3/qKzKUZKnOZ+99AgLX Ki8002TJC1krjWAcrSbRqLMcb4Zn2DTmq2NSUNnwvvY+svLtZWUT4MiOIC5KF/cJjkSumaoEE 8EkcXpTf1ppJHNQN3wccU/gdXEkBUYiV236qsR2WHOSXdA892ETf7pEPCov0Z9dkeQPxpKqdd 8zRsLdiwL7mRc+2SMwq6SzmzQY04oirct6WDJEu5d0DeA7+UAY0jbZcHqBr76BBvND3EgkSk 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:150733 Archived-At: Eli Zaretskii writes: > Can you describe what exactly would you like someone else to > implement? IOW, what minimal change will allow you to continue your > work in this direction? I don't know whether I could do this exactly. But the problem in this bug report is, that we cannot dedicate keyboard input to a non-main thread. Usually this is not a problem, I believe that plain editing shall always happen in the main thread. But sometimes we have the need to communicate with the user from a non-main thread. This is a scenario like echoing the prompt "Do you want to delete file foo?", and the user will type the answer. All this must happen in the current thread, and also related buffers must be kept (often there is a help buffer for possible answers). The point is, that this happens while a pselect is running, which has dedicated keyboard file descriptors to the main thread already. This pselect must finish (likely by waiting for the timeout), keyboard related file descriptors must be rearranged, and a new pselect must be started which reads the input inside the current thread. When finished, file descriptors must be rearranged to the main thread. All of this must happen, while the current thread blocks the main thread. Likely, this cannot be done automatically, so we need a function `set-keyboard-thread' (similar to `set-process-thread'), which is called for scenarios as described. And since the keyboard must be reset to the main thread, maybe a macro like this is needed: (defun with-blocked-keyboard (&rest body) `(block-other-threads ;; maybe via a mutex?? (set-keyboard-thread (current-thread)) ,@body (set-keyboard-thread main-thread))) It is the fiddling with pselect and the keyboard file descriptors, which I'm not able to handle. > Thanks. Best regards, Michael.