From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: Re: User interaction from multiple threads Date: Fri, 24 Aug 2018 13:44:39 +0200 Message-ID: <876000c7ko.fsf@gmx.de> References: <838t59j821.fsf@gnu.org> <87lg92q7ih.fsf@runbox.com> <83a7phdl7r.fsf@gnu.org> <61492e7f622303d02405bedbe65fabae@webmail.orcon.net.nz> <83pnybdaer.fsf@gnu.org> <837ekicw7i.fsf@gnu.org> <877ekiierh.fsf@himinbjorg.adminart.net> <834lflb2fj.fsf@gnu.org> <83h8jk9l41.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1535110987 31444 195.159.176.226 (24 Aug 2018 11:43:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 24 Aug 2018 11:43:07 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: hw@adminart.net, rms@gnu.org, gazally@runbox.com, psainty@orcon.net.nz, emacs-devel@gnu.org, emacs-devel-bounces+psainty=orcon.net.nz@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 24 13:43:02 2018 Return-path: Envelope-to: ged-emacs-devel@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 1ftAUX-00080T-Rd for ged-emacs-devel@m.gmane.org; Fri, 24 Aug 2018 13:43:01 +0200 Original-Received: from localhost ([::1]:41278 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ftAWe-00035e-2Q for ged-emacs-devel@m.gmane.org; Fri, 24 Aug 2018 07:45:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40696) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ftAWX-0002wF-Md for emacs-devel@gnu.org; Fri, 24 Aug 2018 07:45:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ftAWW-0002ra-Lo for emacs-devel@gnu.org; Fri, 24 Aug 2018 07:45:05 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:46701) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ftAWP-0002l6-Ql; Fri, 24 Aug 2018 07:44:58 -0400 Original-Received: from detlef.gmx.de ([79.140.119.207]) by mail.gmx.com (mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MBnPX-1fiP0P3LnD-00AqHX; Fri, 24 Aug 2018 13:44:42 +0200 In-Reply-To: <83h8jk9l41.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 24 Aug 2018 12:20:30 +0300") X-Provags-ID: V03:K1:E2iVd+6VV16ZXZ2gsk5q99R4tc/f0W60xODXJC4+hZ8EKoAnB7f gnL2M+NrPtAWKKgtEbZsuIoSfHUK+yJw8xczxBqvcBH0/A9jw8WRNw9M7mGMu3s8GxrCWox XIYhJFoVjxCsu3dWMVCvhTZB9J9w4wlRYx72LstX9MroISM+HjIk1TpVjUPq+jWbhQoZZsm zyBE+2zugqi/lA257ugdg== X-UI-Out-Filterresults: notjunk:1;V01:K0:cvLnoPZ73gQ=:UMYCBwo2KnAJXxdBxzttEk XFfxDQYbCbBmhvcjuYwN6nDGCAf2NyVI+G8ZXXL4AtgFgmGQppqnMDldSTCxKQ/wHGlSxdsLd kG/5zifXUjHbZSj5J2uZWisBd0NEkldpi/AyVGnMUXQqd+LRLeILpVRgvArlPw08WNrE9WgkI nMavs9Zc0XBNNOsANwKESklcN+quixPDD/JNFnfW1ugc3klTtT2y5EqjGvdmLgoNQciX0mqmY VHYE6VlY6kTGgaoZRuwfpivwzYCfZHqrTaP874TYEMRJ6iNL+7fx0qQ3XBpf20UCeVI1Pls6Z xnRdE0nW2n4gTKSYksNgpqFwLIQiYaX5NsUlS6HAw9ufOaWRK8HGQLSqhusHOiV8cEpm3EwOv fvlp8YWvXoOVBlrskQjE2RmPabTQ8EQWOtnkpswynB6Zw57+Vu0Dx3180TSxVDqbZirEUHFgr viMa38jI3Hgx/zlRDsoyL/8isuUChFszYtz13pzyQp7usidb/1gAb46bnaWU9q8/JVgPzfvMz SCQ5zisgBP9bZ+Gy/puunfk+eiE8gU1LNjemgQMWslSPAuF8l/PjM2wa6bflPvxXy86wNnsge lCniNpjmDHSPMFiXmnveonWBkSK8j/4qc07ocLeFo9qQgPxN2Jtgx3g0llTRUeMrJ3iaxqLmU CYPmzItaySjFwba10pif5sovyTVYy0UpdLnnKa4NyfYK0W0jLDxIJ12Hiiy9euHJL60c2YUo5 KYy9en0G6QAp7rB53PRthqfFKpnPBpBxtuam3dvpB2YavsWDwmXQ2cYYd0Gj77sn9TjYEn+K X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.21 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:228868 Archived-At: Eli Zaretskii writes: > The idea expressed by several people is that once you start > interacting with some thread's prompt, the other threads are locked > out of interaction, until the interacting thread is done with the > series of prompts that allow it to go on with its business. Yes. The simplest locking mechanism I could imagine is a mutex locking such interactions. This must be used for every echo-a-prompt-and-read-the-answer interaction by default (we shall determine all low-level cases). And it shall be a predefined, documented mutex, like `interaction-mutex'. > If that's the first prompt in a series of prompts, we should fix the > prompt to tell what password does it ask for. But it is okay, I > think, to have a series of prompts from a single thread which go like > this: > > Host to logon: > Password: > Initial directory: > > As long as the user knows this is a coherent series of prompts from > the same thread, she will have no difficulty filling in the blanks, > exactly like she does that now. If this series of prompts happen in a thread, the implementation of this prompt series shall protect them by the same `interaction-mutex'. It doesn't hurt for the prompts themselves, because their locking with `interaction-mutex' belongs to the same thread, and mutexes are recursive (meaning that a thread can re-acquire a mutex it owns any number of times). All other threads are locked when they try to acquire the `interaction-mutex'. >>> And how (in what terms) would you suggest to indicate the >>> thread ID in this case? >> >> I don't know enough about the thread feature to figure that out. >> Perhaps based on the thread's top-level function call? >> Do threads have names? > > They do, but the name is optional. If the Lisp program that starts a > thread doesn't provide a name, Emacs will identify it as something > like #, which is not helpful in the situations we > are discussing. > > And even if we do require each thread to have a name, what guarantees > do we have that the name will be more informative than the prompts > about which you were worried? Since there are no rules for thread names, I use the visiting function name and the name of the visited file in the feature/tramp-thread-safe branch. Thread names are here like #, which could be used hardly for indication with limited space in the echo area. The only place it could be used is a tooltip of the prompt, I believe. Best regards, Michael.