GNU logs - #25214, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#25214: 26.0.50; Interacting with user from threads other than the primary
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 16 Dec 2016 15:19:02 +0000
Resent-Message-ID: <handler.25214.B.14819015034892 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 25214
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 25214 <at> debbugs.gnu.org
Cc: Tom Tromey <tom@HIDDEN>
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Reply-To: Eli Zaretskii <eliz@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.14819015034892
          (code B ref -1); Fri, 16 Dec 2016 15:19:02 +0000
Received: (at submit) by debbugs.gnu.org; 16 Dec 2016 15:18:23 +0000
Received: from localhost ([127.0.0.1]:44437 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cHuH9-0001Gq-7N
	for submit <at> debbugs.gnu.org; Fri, 16 Dec 2016 10:18:23 -0500
Received: from eggs.gnu.org ([208.118.235.92]:34609)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1cHuH7-0001Ge-Ha
 for submit <at> debbugs.gnu.org; Fri, 16 Dec 2016 10:18:21 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1cHuH1-00083N-0Z
 for submit <at> debbugs.gnu.org; Fri, 16 Dec 2016 10:18:16 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD
 autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:55813)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <eliz@HIDDEN>) id 1cHuH0-00083J-TW
 for submit <at> debbugs.gnu.org; Fri, 16 Dec 2016 10:18:14 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:53813)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1cHuGz-0003Oa-Df
 for bug-gnu-emacs@HIDDEN; Fri, 16 Dec 2016 10:18:14 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1cHuGu-000825-EU
 for bug-gnu-emacs@HIDDEN; Fri, 16 Dec 2016 10:18:13 -0500
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:54805)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1cHuGY-0007w8-9l; Fri, 16 Dec 2016 10:17:46 -0500
Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2799
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1cHuGX-0008Ez-9E; Fri, 16 Dec 2016 10:17:46 -0500
Date: Fri, 16 Dec 2016 17:17:02 +0200
Message-Id: <837f6z9a4x.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -8.1 (--------)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -8.1 (--------)

Here's some fun with threads:

 emacs -Q

Evaluate:

  (defun my-question ()
    (let (use-dialog-box) ;; in case this is a GUI frame
      (if (y-or-n-p "Yes or no? ")
	  (message "You said YES")
	(message "You said NO"))))

Evaluate:

  (my-question)

You get a question asked in the minibuffer, answer it with Y or N, and
get the corresponding echo.  All's well.

Now evaluate this:

  (make-thread #'my-question "question")

You again get the question asked in the minibuffer, but typing
anything at the prompt causes Emacs to complain that whatever you
typed is "undefined".  Your only fire escape is to close this session
with some mouse gesture, or kill it.

What happens here is that, by the time the new thread runs, the main
(a.k.a. "primary") thread is already idle, i.e. it already called
read_char, which called wait_reading_process_output, which called
thread_select.  (In fact, it's _because_ the primary thread called
thread_select that the new thread was allowed to run at all, since it
has to acquire the global lock for that, and that is only possible
when the running thread releases the lock inside thread_select.)  Now,
when wait_reading_process_output calls thread_select, it prepares the
mask for file descriptors it will wait for to become ready for
reading, in this case there's only one descriptor: the keyboard
descriptor.  So the primary thread is waiting for input from the
keyboard.

Now the new thread starts running and eventually calls y-or-n-p, which
calls read_char, which calls wait_reading_process_output.  But when
this call prepares the mask for the thread_select call, it skips the
keyboard descriptor, because we only allow a single thread to wait on
each descriptor, and the keyboard descriptor is already watched by the
primary thread.  So the new thread ends up not waiting on the keyboard
input descriptor.

The thread_select call then switches back to the primary thread, and
the primary thread receives the Y or N character you type.  But it
doesn't know what to do with it, so it becomes confused.

IOW, user interaction from non-primary threads is currently inherently
unsafe.

And then, of course, there's the use case where two threads ask the
user something via the minibuffer.

Thoughts?



In GNU Emacs 26.0.50.118 (i686-pc-mingw32)
 of 2016-12-16 built on HOME-C4E4A596F7
Repository revision: fb2fdb1435d2520c1cbf2a3d6a53128512a38458
Windowing system distributor 'Microsoft Corp.', version 5.1.2600
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
 'configure --prefix=/d/usr --enable-checking=yes,glyphs --with-wide-int
 --with-modules 'CFLAGS=-O0 -gdwarf-4 -g3''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS MODULES

Important settings:
  value of $LANG: ENU
  locale-coding-system: cp1255

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message subr-x puny seq byte-opt gv
bytecomp byte-compile cl-extra help-mode cconv cl-loaddefs pcase cl-lib
dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec
password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils time-date mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp disp-table
term/w32-win w32-win w32-vars term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript case-table epa-hook jka-cmpr-hook help
simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button
faces cus-face macroexp files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote w32notify w32 multi-tty make-network-process emacs)

Memory information:
((conses 16 102990 12105)
 (symbols 56 21101 0)
 (miscs 48 36 129)
 (strings 16 21030 4737)
 (string-bytes 1 593607)
 (vectors 16 14398)
 (vector-slots 8 444812 4412)
 (floats 8 179 129)
 (intervals 40 269 104)
 (buffers 864 11))




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Eli Zaretskii <eliz@HIDDEN>
Subject: bug#25214: Acknowledgement (26.0.50; Interacting with user from
 threads other than the primary)
Message-ID: <handler.25214.B.14819015034892.ack <at> debbugs.gnu.org>
References: <837f6z9a4x.fsf@HIDDEN>
X-Gnu-PR-Message: ack 25214
X-Gnu-PR-Package: emacs
Reply-To: 25214 <at> debbugs.gnu.org
Date: Fri, 16 Dec 2016 15:19:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 25214 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
25214: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D25214
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#25214: 26.0.50; Interacting with user from threads other than the primary
Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Pit--Claudel <clement.pit@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 19 Dec 2016 04:32:02 +0000
Resent-Message-ID: <handler.25214.B.148212191220949 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 25214
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 25214 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.148212191220949
          (code B ref -1); Mon, 19 Dec 2016 04:32:02 +0000
Received: (at submit) by debbugs.gnu.org; 19 Dec 2016 04:31:52 +0000
Received: from localhost ([127.0.0.1]:46704 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cIpc7-0005Ro-Jz
	for submit <at> debbugs.gnu.org; Sun, 18 Dec 2016 23:31:52 -0500
Received: from eggs.gnu.org ([208.118.235.92]:50168)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <clement.pit@HIDDEN>) id 1cIpc5-0005RX-HN
 for submit <at> debbugs.gnu.org; Sun, 18 Dec 2016 23:31:49 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <clement.pit@HIDDEN>) id 1cIpby-0001XT-Uy
 for submit <at> debbugs.gnu.org; Sun, 18 Dec 2016 23:31:44 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM
 autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:54194)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <clement.pit@HIDDEN>)
 id 1cIpby-0001XP-RV
 for submit <at> debbugs.gnu.org; Sun, 18 Dec 2016 23:31:42 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:41139)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <clement.pit@HIDDEN>) id 1cIpbw-0006dw-Kx
 for bug-gnu-emacs@HIDDEN; Sun, 18 Dec 2016 23:31:42 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <clement.pit@HIDDEN>) id 1cIpbt-0001Ux-EM
 for bug-gnu-emacs@HIDDEN; Sun, 18 Dec 2016 23:31:40 -0500
Received: from mout.kundenserver.de ([217.72.192.74]:58126)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <clement.pit@HIDDEN>)
 id 1cIpbt-0001UF-46
 for bug-gnu-emacs@HIDDEN; Sun, 18 Dec 2016 23:31:37 -0500
Received: from [18.189.127.106] ([18.189.127.106]) by mrelayeu.kundenserver.de
 (mreue102 [212.227.15.184]) with ESMTPSA (Nemesis) id
 0Lm4KP-1crtNW0UbJ-00ZdRP for <bug-gnu-emacs@HIDDEN>; Mon, 19 Dec 2016
 05:31:35 +0100
References: <837f6z9a4x.fsf@HIDDEN>
From: =?UTF-8?Q?Cl=C3=A9ment?= Pit--Claudel <clement.pit@HIDDEN>
Message-ID: <4ab8f369-393d-3c72-9abf-d68d6880151b@HIDDEN>
Date: Sun, 18 Dec 2016 23:31:28 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.5.1
MIME-Version: 1.0
In-Reply-To: <837f6z9a4x.fsf@HIDDEN>
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="t0Fj4ohbQ3HTGkthfNTJG902RKKwi1mjV"
X-Provags-ID: V03:K0:KkwI9tTJ3J16Bb8enF5Xuy17FA+oH/RdWqVvOHcz/5niTcApGIj
 ZvfpfYEJ+mL6MXmyHJwdYrlMcCtMVtlrGRupwmm9xwbO3G9Cc6j6mecwkx3nwiv/Q65HwIk
 UWuT3y+mZPYhW+jTJ+EsMmjGw5eRZwnI9ZWdyxOpMfcb+27rr26KJkCWsALpKlOhKX2dxrh
 d76ohLNVYLBObStJLFRbQ==
X-UI-Out-Filterresults: notjunk:1;V01:K0:eAAhubqfXS4=:1V0CHqB0rUeD27eRx49F3X
 JXh8OxiL11NtoX2lXbcwS9JD8GetFZJaX2hQc78E3Y/bBiRBJzLRHM20vr2G2YibPMo7VmTaF
 n9k1/VckldaickqEhqYWATZ8+PrP1Te+IohqiWKM8FRZJakWoMEwVfffCS6bWM5J3Nv1QU/Ff
 PWYBMD16BtQIlnkyATRYt3ti7nQRKZKKFh75UH/tkl/ANbTpzOqqR2X77rlhvQE0C/debeWhC
 NA4YuKloNyDZyT7SKV9Dn+W/5mRjWVyoRVu2MDOlrAdHLC1FWdLd5ikjQRh2kc/2spWoDwCL3
 w4Mk2oIu0liZxtOLLMDUwhcXhC5BNJV8LxVp0owgNnH98WgMbfFHLezTzYQfTkNXkec/CfkNz
 r6K02z10P5oXAFdW2oEp5Lcps0rb3WyTpoQLP/wXIO229CQAx9lsZ3gzCsm279iZKmFsj37IW
 a6z7Z+EfEkhUx/3j0/IQaM8CvYW4lwHWiZYHbLjnZuTH9/C5TtBl2uBvefa5lZNVRmS6m1jyq
 VWhP77RNvMNW5nWIawTr0ZiuiyjWV88EDHSiFVEV0AQAXnOWYFnOseFIx6+RdvNwy8HfcfDTL
 TAB9MMr5RZOA0VpmQVmUyM/ptVq6zu44uFWn7JB9vyqnn7wdU25x0LfEBVFuNoNmnS5bLDqJf
 5jX7ipM9i3FuT8DdH5OjZtE7ApWJp/U2ihVxWKOF4kmZg2VVDCpjwUqQjyXsCz/eyeaU=
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
 [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--t0Fj4ohbQ3HTGkthfNTJG902RKKwi1mjV
Content-Type: multipart/mixed; boundary="P1CDDCW2e9ga49k3VrVD5uaa7BjXeA6iS";
 protected-headers="v1"
From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= <clement.pit@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Message-ID: <4ab8f369-393d-3c72-9abf-d68d6880151b@HIDDEN>
Subject: Re: bug#25214: 26.0.50; Interacting with user from threads other than
 the primary
References: <837f6z9a4x.fsf@HIDDEN>
In-Reply-To: <837f6z9a4x.fsf@HIDDEN>

--P1CDDCW2e9ga49k3VrVD5uaa7BjXeA6iS
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Hi Eli,

> Thoughts?

I don't have that much concurrency experience, but this sounds like an is=
sue that other languages have had to deal with in the context of GUIs.  I=
n Microsoft's Windows Forms, for example, applications start with a singl=
e thread (the UI thread) running a message pump, and other threads that w=
ant to interact with the user may do so only by posting a message (using =
Control.Invoke) to the UI thread.

If I understand your description of the problem correctly, what happens i=
s essentially that the main thread and the background thread are competin=
g for keyboard access.  If so, could the solution be to route all UI requ=
ests through the main thread?  Concretely, this would mean that in the co=
ntext of a secondary thread, calling "read-from-minibuffer" really means =
pushing a message (tagged with a thread id) into a queue of "pending-read=
s-from-minibuffer", then repeatedly `thread-yield`ing until the UI thread=
 has pushed the user's response into a map of "processed-reads-from-minib=
uffer".  The user's response would be collected by the main thread.

Alternatively, could we simply disallow this type of interaction until we=
 have a good story about it? That would bring us closer to the way web wo=
rkers work in Javascript (they need to post a message to interact with th=
e UI/DOM).

Cheers,
Cl=E9ment.

On 2016-12-16 10:17, Eli Zaretskii wrote:
> Here's some fun with threads:
>=20
>  emacs -Q
>=20
> Evaluate:
>=20
>   (defun my-question ()
>     (let (use-dialog-box) ;; in case this is a GUI frame
>       (if (y-or-n-p "Yes or no? ")
> 	  (message "You said YES")
> 	(message "You said NO"))))
>=20
> Evaluate:
>=20
>   (my-question)
>=20
> You get a question asked in the minibuffer, answer it with Y or N, and
> get the corresponding echo.  All's well.
>=20
> Now evaluate this:
>=20
>   (make-thread #'my-question "question")
>=20
> You again get the question asked in the minibuffer, but typing
> anything at the prompt causes Emacs to complain that whatever you
> typed is "undefined".  Your only fire escape is to close this session
> with some mouse gesture, or kill it.
>=20
> What happens here is that, by the time the new thread runs, the main
> (a.k.a. "primary") thread is already idle, i.e. it already called
> read_char, which called wait_reading_process_output, which called
> thread_select.  (In fact, it's _because_ the primary thread called
> thread_select that the new thread was allowed to run at all, since it
> has to acquire the global lock for that, and that is only possible
> when the running thread releases the lock inside thread_select.)  Now,
> when wait_reading_process_output calls thread_select, it prepares the
> mask for file descriptors it will wait for to become ready for
> reading, in this case there's only one descriptor: the keyboard
> descriptor.  So the primary thread is waiting for input from the
> keyboard.
>=20
> Now the new thread starts running and eventually calls y-or-n-p, which
> calls read_char, which calls wait_reading_process_output.  But when
> this call prepares the mask for the thread_select call, it skips the
> keyboard descriptor, because we only allow a single thread to wait on
> each descriptor, and the keyboard descriptor is already watched by the
> primary thread.  So the new thread ends up not waiting on the keyboard
> input descriptor.
>=20
> The thread_select call then switches back to the primary thread, and
> the primary thread receives the Y or N character you type.  But it
> doesn't know what to do with it, so it becomes confused.
>=20
> IOW, user interaction from non-primary threads is currently inherently
> unsafe.
>=20
> And then, of course, there's the use case where two threads ask the
> user something via the minibuffer.
>=20
> Thoughts?
>=20
>=20
>=20
> In GNU Emacs 26.0.50.118 (i686-pc-mingw32)
>  of 2016-12-16 built on HOME-C4E4A596F7
> Repository revision: fb2fdb1435d2520c1cbf2a3d6a53128512a38458
> Windowing system distributor 'Microsoft Corp.', version 5.1.2600
> Recent messages:
> For information about GNU Emacs and the GNU system, type C-h C-a.
>=20
> Configured using:
>  'configure --prefix=3D/d/usr --enable-checking=3Dyes,glyphs --with-wid=
e-int
>  --with-modules 'CFLAGS=3D-O0 -gdwarf-4 -g3''
>=20
> Configured features:
> XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
> TOOLKIT_SCROLL_BARS MODULES
>=20
> Important settings:
>   value of $LANG: ENU
>   locale-coding-system: cp1255
>=20
> Major mode: Lisp Interaction
>=20
> Minor modes in effect:
>   tooltip-mode: t
>   global-eldoc-mode: t
>   electric-indent-mode: t
>   mouse-wheel-mode: t
>   tool-bar-mode: t
>   menu-bar-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   blink-cursor-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>   line-number-mode: t
>   transient-mark-mode: t
>=20
> Load-path shadows:
> None found.
>=20
> Features:
> (shadow sort mail-extr emacsbug message subr-x puny seq byte-opt gv
> bytecomp byte-compile cl-extra help-mode cconv cl-loaddefs pcase cl-lib=

> dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec
> password-cache epa derived epg epg-config gnus-util rmail rmail-loaddef=
s
> mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
> mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
> mail-utils time-date mule-util tooltip eldoc electric uniquify
> ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp disp-table
> term/w32-win w32-win w32-vars term/common-win tool-bar dnd fontset imag=
e
> regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mod=
e
> lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer
> select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
> term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
> vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
> hebrew greek romanian slovak czech european ethiopic indian cyrillic
> chinese composite charscript case-table epa-hook jka-cmpr-hook help
> simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button
> faces cus-face macroexp files text-properties overlay sha1 md5 base64
> format env code-pages mule custom widget hashtable-print-readable
> backquote w32notify w32 multi-tty make-network-process emacs)
>=20
> Memory information:
> ((conses 16 102990 12105)
>  (symbols 56 21101 0)
>  (miscs 48 36 129)
>  (strings 16 21030 4737)
>  (string-bytes 1 593607)
>  (vectors 16 14398)
>  (vector-slots 8 444812 4412)
>  (floats 8 179 129)
>  (intervals 40 269 104)
>  (buffers 864 11))
>=20
>=20
>=20
>=20


--P1CDDCW2e9ga49k3VrVD5uaa7BjXeA6iS--

--t0Fj4ohbQ3HTGkthfNTJG902RKKwi1mjV
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJYV2KlAAoJEPqg+cTm90wjc6IQAJM8Im7ioxuNgHSgR1MaDFJn
uSZ1Rz/2qxPH1S+6RWPnci10r2eCcTmyOGJDSB0urYzQj+Drns5c/6I440J4NVAe
8hbebqnsDNCmeShnqtjzkBDc5FWQkGBS50VgCePLFWKdOL8vPSe+dKe/DcE00Jvg
WtwlWiYb8QLhD3itLAjoNxgqf17ReWf7Al2CRz6jy9P8UfvMjwyHij8zfep0oAap
nWcXwG5XYolx73hEFmd7p7KVYPVZduI1d+pDMwUCa/U5UqJjGymHKldwUNAAfmfj
E52e2xJ22Uo1lefUmUQKZFyi73ZeToOI0A+bhdBl+gwnjMyC9o950/K5w1nezrrz
N+hey44O+LApjD8IjbWobc9WHHLKBpplYfCc6p1nNS8NNyWwDwTIkxFNjDG2o8CZ
T+9QCte97ikDhmvwDHtZeugrOvD1XUfJjUNUkKrqIeK5CbF/HGKXIEiG3UyJ7tiS
OF89pbIkPYG0KznwCmCRyfHT8i8zPvDTMarMSuOXtZ0i0p1ELZqQvfLzluMKIUMf
KZByN3IrfjMwd+hHpvuOUj0EscAM4Tm97OkxWmj4xDEBNild2L/IFG7N9CQq5bhy
RU5DnjRofGYdo0/mQlZrM5xV7+hftRzfG6RJ8cmuQrDqh0Xnka8NZ0/fHUw7CJku
yDo3dAv0vInoI1e36iFx
=xRZM
-----END PGP SIGNATURE-----

--t0Fj4ohbQ3HTGkthfNTJG902RKKwi1mjV--




Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 13 Aug 2018 12:11:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 13 08:11:21 2018
Received: from localhost ([127.0.0.1]:49326 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fpBgv-0007w5-FM
	for submit <at> debbugs.gnu.org; Mon, 13 Aug 2018 08:11:21 -0400
Received: from mout.gmx.net ([212.227.17.22]:41627)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael.albinus@HIDDEN>) id 1fpBgt-0007vp-Ub
 for control <at> debbugs.gnu.org; Mon, 13 Aug 2018 08:11:20 -0400
Received: from detlef.gmx.de ([178.20.90.0]) by mail.gmx.com (mrgmx101
 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MOjMY-1fmQ0V1pkk-0067Pk for
 <control <at> debbugs.gnu.org>; Mon, 13 Aug 2018 14:11:13 +0200
Date: Mon, 13 Aug 2018 14:11:12 +0200
Message-Id: <87600ewjof.fsf@HIDDEN>
To: control <at> debbugs.gnu.org
From: Michael Albinus <michael.albinus@HIDDEN>
Subject: control message for bug #32426
X-Provags-ID: V03:K1:ahpZRitRw7Kst2FwJdiOKTsnJJyPbe9VLl60HMgBpeDub4UDVUr
 jXNW+t84AXLgaMN4HGEKGolWvGmPYETrK2Cf8OCXq2fhvAhrioxNyWGfmyNpq6irH8uWHnJ
 CrJ5obAxz4ig8bv7/U4ZWPSwnCEkPMYseJ74XcTHYAfbsNcSYDydH9KfbJXaZ0v5ocewI4y
 WWAbNF74PkiSPjur7A1nw==
X-UI-Out-Filterresults: notjunk:1;V01:K0:QqMPYVwq5lg=:Tg5+zWNE2pw1gbdpkx4bI/
 0aLz+qlT+zXgzcVFZ/wdNZYqleec0noDc6psLOFuRVSeQm+NyJwx/CTK1/V7XvQIc/zEmqWc3
 xqtFrnl5tGcsAgVKObEtzJY6O+iM9F/odCUcTJkaBXz2m7ya9pmn/8Q8fbtOpaozw4r/hc1os
 aMPLjSX+i7sAjRwfpu0A/+n8rWJbOUln957ECeUqlBINIf0AJijmdVt52OsknKjO2E7uyFtDA
 fw36yr6GmUuDgtqV3tLKOW3sI45R1DhjLevTKgT06y3TvNtV5g3rA/qhRhZldFAi5+NJUKmWV
 ZUjnz4Hoi54vQd/CBZKoyff/mSeuouivK4yUpzGTshpDNngUmkjdfIFXqz0f9D5pR39TM1gfX
 8wiN/jrP4GXbN43F55w5xxoZVEzhCbVEYsrhYZbxvmIEDQzGASnjZDxkwcLM8foTsb/TyilrD
 KN+wHMsQx/ufd1mrthV5mLO+nPMBv9CNNpt9M/cnc6cBMHg9fcH1e2Asp2HVwT/Fw9AeNWYBt
 ySdhyJzj+04zZrMAbXOVtXkLrZMKKzV/Ev4ROLdflQmBYzMcJvcwTek+iQfgqlCGXiRn72f1I
 zHZOa1oxw88vFuZy5P6Tjgzl6i7eHh9kahw8xULzGK9m/o0Gw1jYsRp/NRL7EpxIMqSiiHJ1R
 96MnG1yUeJbq+kl7HQXt7ZRHLha8WP8OjdztwBO4rRbTCTu3y2KKsvHUdcfzqeQyjLgOGX4kn
 YKqHb+ihJumJemBXJtVH0qrVHSTANHz7m13RB8l4NaDZBfho8z5rSPuhnsg=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

merge 32426 25214




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#25214: 26.0.50; Interacting with user from threads other than the primary
In-Reply-To: <837f6z9a4x.fsf@HIDDEN>
Resent-From: Michael Albinus <michael.albinus@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 17 Sep 2018 14:07:02 +0000
Resent-Message-ID: <handler.25214.B25214.153719319219770 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 25214
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: 25214 <at> debbugs.gnu.org, Tom Tromey <tom@HIDDEN>
Received: via spool by 25214-submit <at> debbugs.gnu.org id=B25214.153719319219770
          (code B ref 25214); Mon, 17 Sep 2018 14:07:02 +0000
Received: (at 25214) by debbugs.gnu.org; 17 Sep 2018 14:06:32 +0000
Received: from localhost ([127.0.0.1]:43219 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1g1uAa-00058n-0H
	for submit <at> debbugs.gnu.org; Mon, 17 Sep 2018 10:06:32 -0400
Received: from mout.gmx.net ([212.227.15.15]:45153)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael.albinus@HIDDEN>) id 1g1uAY-00058Z-Gp
 for 25214 <at> debbugs.gnu.org; Mon, 17 Sep 2018 10:06:30 -0400
Received: from detlef.gmx.de ([212.91.249.153]) by mail.gmx.com (mrgmx003
 [212.227.17.190]) with ESMTPSA (Nemesis) id 0Lbujs-1faEKM2vFk-00jGsu; Mon, 17
 Sep 2018 16:06:10 +0200
From: Michael Albinus <michael.albinus@HIDDEN>
References: <837f6z9a4x.fsf@HIDDEN>
Date: Mon, 17 Sep 2018 16:06:07 +0200
Message-ID: <87zhwguskw.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:kYQmBzU7L7nXQZso0ZOMtVo3TpwxamKt1MpBoGmZlo+myjyfUjM
 mIPxmq329VflDRiNvbfK7fkw5ECc6/5jH/fHQcRy9i9zOdMZICctcfyq2RXFyzFVjWmqrwO
 btbNXCAsdCvHZKZqFPQX2gEmZR7qdz2pbbgc1H4C3ToJgW5gjUT8JSox6mjDtKirUYKOg0j
 uMfdCh3oKzEALEuZFt7qA==
X-UI-Out-Filterresults: notjunk:1;V01:K0:rOQtXO6KPPI=:vTobkOKrtGZkAQfhcILGip
 4COc0vvHK9WHuwvwlo/4hiEleHRDbYnbLECUHT4+E1TtKj0Ez3kcXKqpLfEh8tas1GFdILpEx
 m4YFeQQhTFAKe9ocTsiTKTofin4WXA9asifuMETj/fyR8YYmxGGMulgssBYAk6AOx7NKbmuj1
 FRZx16CWe01Ce+i5ilUcGnBmZTqJLCS5shAJei1oBabvTcJLTgBYgsxewtHK9mjB2hl6JGNSx
 Aspg9b+/dF3kcyKr8yu83PXYuUtsZwwf6mgXJaXHdDrGOdVsV4sowUB+6YpCgRvYYHXGZRNDp
 QkVDDikpUV8syG06BBa9y9isVNto63q24vJ57i7DYQ7i5S5fnwPeaF4Mf2OqBVEmLnRsXFPLz
 UegxYurOkID1iEFDmRBLbEE4wJbWrZ3vSCuuzjo3+W2hg0A6vBoUFVhVLcZ0UtBrA7gFbLk/e
 5L+locxLTsg+A8cRm1TSXvB0o4eQIu3nMcJpqI/eOaNynEJ0hsvpjBvzIZgEBZuAOYj1eD/0O
 1HzRRGh8W9rjFDyBVHqmXYowJ7E4PjaeQY7BToa1NrYC8xuaLs107cdCmG997XF/jSjqmn/ps
 +Zu+Izdbxef+jI2eJUXX7qbVlg+qYKF83zCjsXVqBMm3ze1npwjZNdb3xM//hizRmXeDgGttT
 RtmCiVx2l0XKiN9uIeHmvFXozFHQhE5NcYgAoY2OH2Yfmmsdt7pk/ZtoPfs3VJG/q7A/6Vrtz
 v/5k5k/vuW+4DXWpHyFqwSLss/h8jhAIZdL3n+jmev/HLkge3jGh/IGGh69cqh6gArhkqwgXw
 5OGal8GmWD1L+XY1gzaREgUWW2dganVlv7Y1jSGEDR0HApvPTw=
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

> Here's some fun with threads:
>
>  emacs -Q
>
> Evaluate:
>
>   (defun my-question ()
>     (let (use-dialog-box) ;; in case this is a GUI frame
>       (if (y-or-n-p "Yes or no? ")
> 	  (message "You said YES")
> 	(message "You said NO"))))
>
> Now evaluate this:
>
>   (make-thread #'my-question "question")
>
> You again get the question asked in the minibuffer, but typing
> anything at the prompt causes Emacs to complain that whatever you
> typed is "undefined".  Your only fire escape is to close this session
> with some mouse gesture, or kill it.
>
> What happens here is that, by the time the new thread runs, the main
> (a.k.a. "primary") thread is already idle, i.e. it already called
> read_char, which called wait_reading_process_output, which called
> thread_select.  (In fact, it's _because_ the primary thread called
> thread_select that the new thread was allowed to run at all, since it
> has to acquire the global lock for that, and that is only possible
> when the running thread releases the lock inside thread_select.)  Now,
> when wait_reading_process_output calls thread_select, it prepares the
> mask for file descriptors it will wait for to become ready for
> reading, in this case there's only one descriptor: the keyboard
> descriptor.  So the primary thread is waiting for input from the
> keyboard.
>
> Now the new thread starts running and eventually calls y-or-n-p, which
> calls read_char, which calls wait_reading_process_output.  But when
> this call prepares the mask for the thread_select call, it skips the
> keyboard descriptor, because we only allow a single thread to wait on
> each descriptor, and the keyboard descriptor is already watched by the
> primary thread.  So the new thread ends up not waiting on the keyboard
> input descriptor.
>
> The thread_select call then switches back to the primary thread, and
> the primary thread receives the Y or N character you type.  But it
> doesn't know what to do with it, so it becomes confused.
>
> IOW, user interaction from non-primary threads is currently inherently
> unsafe.

IOW, user interaction from non-primary threads is currently inherently
impossible.

I've tried to understand the mechanism in process.c, and I summarize it
(mainly for my understanding, but also to give you a chance to correct me).

The fd mask is controlled by fd_callback_info, an array (indexed by
fd's) over the struct fd_callback_data. There are two relevant struct
fields: thread and waiting_thread. thread is set in Fset_process_thread
for the infd and outfd file descriptors of the process, it shall be NULL
in the example given above.

waiting_thread is always set to current_thread, in the
compute_input_wait_mask, compute_non_process_wait_mask,
compute_non_keyboard_wait_mask and compute_write_mask functions. The
condition is always, that waiting_thread is either NULL or
current_thread.

A file descriptor, be it for the keyboard or process related or
whatever, is only taken into account during setting an fd_mask, when
either both thread and waiting_thread are NULL, or when one of the
struct fields is set to a thread, being equal to the current
thread. IIUC, thead has precedence over waiting_thread, but this might
be an implementation detail only. So far, it is expected that at least
one of the fields is NULL.

In order to fix the problem of reading input in a non-primary thread, we
need a new function which request I/O control to the current thread. It
needs

* to request control for the keyboard. This could be indicated by a
  signal to the main thread, which is *not* an error signal but a
  special one, let's call it `thread-set-keyboard'.

* to handle this signal in `thread-handle-event', by calling a
  respective function (let's call it `thread--set-keyboard'). This
  function sets the struct event thread to the thread which has
  delivered by the `thread-set-keyboard' signal. Next time fd_mask is
  prepared, the keyboard fd would be taken into account for the
  requesting thread.

* to stop/recall the recent pselect for the main thread in order to free
  the keyboard fd. Don't know how to do this.

* to provide a mechanism which resets the thread struct field of the
  keyboard fd to NULL, in order to let the main thread use the
  keyboard. Here I have also no idea how to do this.

> And then, of course, there's the use case where two threads ask the
> user something via the minibuffer.

This scenario shall also be possible then.

> Thoughts?

Here I am :-)

Best regards, Michael.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#25214: 26.0.50; Interacting with user from threads other than the primary
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 17 Sep 2018 18:43:03 +0000
Resent-Message-ID: <handler.25214.B25214.153720974816202 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 25214
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Michael Albinus <michael.albinus@HIDDEN>
Cc: 25214 <at> debbugs.gnu.org, tom@HIDDEN
Received: via spool by 25214-submit <at> debbugs.gnu.org id=B25214.153720974816202
          (code B ref 25214); Mon, 17 Sep 2018 18:43:03 +0000
Received: (at 25214) by debbugs.gnu.org; 17 Sep 2018 18:42:28 +0000
Received: from localhost ([127.0.0.1]:43352 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1g1yTb-0004DG-UB
	for submit <at> debbugs.gnu.org; Mon, 17 Sep 2018 14:42:28 -0400
Received: from eggs.gnu.org ([208.118.235.92]:46744)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1g1yTa-0004D0-Hg
 for 25214 <at> debbugs.gnu.org; Mon, 17 Sep 2018 14:42:26 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1g1yTR-0003Vz-3q
 for 25214 <at> debbugs.gnu.org; Mon, 17 Sep 2018 14:42:21 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05 autolearn=disabled
 version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:55544)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1g1yTA-0003Dr-Kz; Mon, 17 Sep 2018 14:42:00 -0400
Received: from [176.228.60.248] (port=4309 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1g1yT8-0005CE-Tk; Mon, 17 Sep 2018 14:42:00 -0400
Date: Mon, 17 Sep 2018 21:41:47 +0300
Message-Id: <83fty8ge50.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-reply-to: <87zhwguskw.fsf@HIDDEN> (message from Michael Albinus on Mon, 17
 Sep 2018 16:06:07 +0200)
References: <837f6z9a4x.fsf@HIDDEN> <87zhwguskw.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.0 (------)

> From: Michael Albinus <michael.albinus@HIDDEN>
> Cc: 25214 <at> debbugs.gnu.org,  Tom Tromey <tom@HIDDEN>
> Date: Mon, 17 Sep 2018 16:06:07 +0200
> 
> The fd mask is controlled by fd_callback_info, an array (indexed by
> fd's) over the struct fd_callback_data. There are two relevant struct
> fields: thread and waiting_thread. thread is set in Fset_process_thread
> for the infd and outfd file descriptors of the process, it shall be NULL
> in the example given above.
> 
> waiting_thread is always set to current_thread, in the
> compute_input_wait_mask, compute_non_process_wait_mask,
> compute_non_keyboard_wait_mask and compute_write_mask functions. The
> condition is always, that waiting_thread is either NULL or
> current_thread.
> 
> A file descriptor, be it for the keyboard or process related or
> whatever, is only taken into account during setting an fd_mask, when
> either both thread and waiting_thread are NULL, or when one of the
> struct fields is set to a thread, being equal to the current
> thread. IIUC, thead has precedence over waiting_thread, but this might
> be an implementation detail only. So far, it is expected that at least
> one of the fields is NULL.

That is correct, AFAIR.

> In order to fix the problem of reading input in a non-primary thread, we
> need a new function which request I/O control to the current thread. It
> needs
> 
> * to request control for the keyboard. This could be indicated by a
>   signal to the main thread, which is *not* an error signal but a
>   special one, let's call it `thread-set-keyboard'.
> 
> * to handle this signal in `thread-handle-event', by calling a
>   respective function (let's call it `thread--set-keyboard'). This
>   function sets the struct event thread to the thread which has
>   delivered by the `thread-set-keyboard' signal. Next time fd_mask is
>   prepared, the keyboard fd would be taken into account for the
>   requesting thread.
> 
> * to stop/recall the recent pselect for the main thread in order to free
>   the keyboard fd. Don't know how to do this.
> 
> * to provide a mechanism which resets the thread struct field of the
>   keyboard fd to NULL, in order to let the main thread use the
>   keyboard. Here I have also no idea how to do this.

It's not all we need (remember all that talk about serializing access
to the echo area?), but it's a beginning.  And the crucial piece is
bullet #3, because thread-signal will not interrupt the pselect call.
And if we are not too lucky, the pselect call could have been made
with a long timeout.  So this is the first obstacle to negotiate.

So what means do we have to interrupt a pselect call from another
thread?

(I'm not sure I understand why you thought we'd need bullet #2, btw.
Once we interrupt the pselect call, the main thread should become
stuck trying to take the global lock, so I don't think we need any
trickery here, because the other thread, which is running, will have
arranged for it to be the current thread.)

Thanks.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#25214: 26.0.50; Interacting with user from threads other than the primary
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 17 Sep 2018 19:13:01 +0000
Resent-Message-ID: <handler.25214.B25214.153721154919394 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 25214
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: michael.albinus@HIDDEN
Cc: 25214 <at> debbugs.gnu.org, tom@HIDDEN
Received: via spool by 25214-submit <at> debbugs.gnu.org id=B25214.153721154919394
          (code B ref 25214); Mon, 17 Sep 2018 19:13:01 +0000
Received: (at 25214) by debbugs.gnu.org; 17 Sep 2018 19:12:29 +0000
Received: from localhost ([127.0.0.1]:43368 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1g1ywd-00052h-6O
	for submit <at> debbugs.gnu.org; Mon, 17 Sep 2018 15:12:27 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57388)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1g1ywc-00052W-37
 for 25214 <at> debbugs.gnu.org; Mon, 17 Sep 2018 15:12:26 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1g1ywS-0007E1-11
 for 25214 <at> debbugs.gnu.org; Mon, 17 Sep 2018 15:12:20 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled
 version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:56125)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1g1yw9-0006Z2-6w; Mon, 17 Sep 2018 15:11:58 -0400
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 <eliz@HIDDEN>)
 id 1g1yw8-0004rb-NH; Mon, 17 Sep 2018 15:11:57 -0400
Date: Mon, 17 Sep 2018 22:11:52 +0300
Message-Id: <83efdsgcqv.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-reply-to: <83fty8ge50.fsf@HIDDEN> (message from Eli Zaretskii on Mon, 17
 Sep 2018 21:41:47 +0300)
References: <837f6z9a4x.fsf@HIDDEN> <87zhwguskw.fsf@HIDDEN>
 <83fty8ge50.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.0 (------)

> Date: Mon, 17 Sep 2018 21:41:47 +0300
> From: Eli Zaretskii <eliz@HIDDEN>
> Cc: 25214 <at> debbugs.gnu.org, tom@HIDDEN
> 
> 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.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#25214: 26.0.50; Interacting with user from threads other than the primary
Resent-From: Michael Albinus <michael.albinus@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 18 Sep 2018 08:22:01 +0000
Resent-Message-ID: <handler.25214.B25214.153725891931989 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 25214
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: 25214 <at> debbugs.gnu.org, tom@HIDDEN
Received: via spool by 25214-submit <at> debbugs.gnu.org id=B25214.153725891931989
          (code B ref 25214); Tue, 18 Sep 2018 08:22:01 +0000
Received: (at 25214) by debbugs.gnu.org; 18 Sep 2018 08:21:59 +0000
Received: from localhost ([127.0.0.1]:43596 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1g2BGg-0008Jt-QY
	for submit <at> debbugs.gnu.org; Tue, 18 Sep 2018 04:21:59 -0400
Received: from mout.gmx.net ([212.227.15.19]:60989)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael.albinus@HIDDEN>) id 1g2BGe-0008Je-LU
 for 25214 <at> debbugs.gnu.org; Tue, 18 Sep 2018 04:21:57 -0400
Received: from detlef.gmx.de ([212.86.62.20]) by mail.gmx.com (mrgmx001
 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MGS9o-1fxjHt1MK8-00DFuC; Tue, 18
 Sep 2018 10:21:37 +0200
From: Michael Albinus <michael.albinus@HIDDEN>
References: <837f6z9a4x.fsf@HIDDEN> <87zhwguskw.fsf@HIDDEN>
 <83fty8ge50.fsf@HIDDEN>
Date: Tue, 18 Sep 2018 10:21:35 +0200
In-Reply-To: <83fty8ge50.fsf@HIDDEN> (Eli Zaretskii's message of "Mon, 17 Sep
 2018 21:41:47 +0300")
Message-ID: <87a7ofmd0w.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:s+zDSfKKFGp4frEC80kud6llM3MdKiL71JKHQvMPngia2X1hzNh
 kJ5+Hj3Q3UD2Ix1euxov5yYoWMgGvUB+QeSoh7GYLK4kxzQzxRQ2AKS7QQSeEKtH2pyBiqE
 Fv5m3x7bdBn+jHkgMtRm39PFipve04iiZSDZ+akkj3jsFt9f9MB2LN9XAoy3u8vgSbokf3B
 ZlOETV03t8j2auzkX8c3Q==
X-UI-Out-Filterresults: notjunk:1;V01:K0:sqWgCmU6YJE=:DS17RLyY3+G/XpmWCOe7tF
 zVJZMJjAH+o/LomWzSfVUq0sGTAh3OBvNv280q+Va72nO/uS/MBJas8K8aMGPF/YLbE0q7ooD
 puXLezRtiiozICcyYhosTQpRfnVSU04Wrm46d7XLl8UPNa46NBM58FpWV8xMuieJPuJD55IMd
 N8s2zKOuxGE5mY50thDpzpBq8CcF1vxFIoIzh6yb3RB2xczIw4nwXr1wt4ua7HhZv3GwhLYFP
 Uo35DbZo7L2ntVRgm+hZHP2+FUaIr90TwLNvdWED87DXr8tRS8Uj2euHrcqBPSSpoqw6j2my9
 Log5xk00wAMTJcJ4WmZ/rss9aCKmagb0iHZ/M3LmNF1KpGEDRkMFeWqX7Yr+cvlHBXV2yRjaE
 jpjD9r6P6FztZP0Iqn7JZg++bruMWyp/S6J5Xb9aDL4NW2KPSId1DTGdpfTHX1rdgOqrYrUIx
 ozKojBR3/t5m+u1DD0m6mD7v6pKvnB7CbEYkz5sof70Qlyf6q1N0JlQoowysvqDLemFnaaPZ9
 HkLapsNqmzZisM2aAAguysHO3dpqjGaweUdQR2tsCB0+WxiTJ2aCbtn5amAVdw5/E8zvw7o3o
 UQ3uWhwFmDSj2+dbu5QIiXD/5cuAMlRDQTvDRJpvv9/WpDO1Os09hThY5HLUZxUpuvQixkz1P
 FYlIA3ZDZ4VAxWwOCZVth8Jv6EaLjmbpzFe+nP+4E1QdoAXWB60m4XOQGm3krR40KEoEOqxsI
 MoG60fI3MF0BzXUF8Qw1FbPc8BzJN12otKxV3QeVWmgpK0jPTYaLsuCBurlGvKI+6hhUrk211
 I6gg7tUMADlZEKo7aUGbmmYyIa7IbsizSGEE4KHjFUiTbiLGhk=
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

Hi Eli,

>> In order to fix the problem of reading input in a non-primary thread, we
>> need a new function which request I/O control to the current thread. It
>> needs
>>
>> * to request control for the keyboard. This could be indicated by a
>>   signal to the main thread, which is *not* an error signal but a
>>   special one, let's call it `thread-set-keyboard'.
>>
>> * to handle this signal in `thread-handle-event', by calling a
>>   respective function (let's call it `thread--set-keyboard'). This
>>   function sets the struct event thread to the thread which has
>>   delivered by the `thread-set-keyboard' signal. Next time fd_mask is
>>   prepared, the keyboard fd would be taken into account for the
>>   requesting thread.
>>
>> * to stop/recall the recent pselect for the main thread in order to free
>>   the keyboard fd. Don't know how to do this.
>>
>> * to provide a mechanism which resets the thread struct field of the
>>   keyboard fd to NULL, in order to let the main thread use the
>>   keyboard. Here I have also no idea how to do this.
>
> It's not all we need (remember all that talk about serializing access
> to the echo area?), but it's a beginning.

Exactly.

> And the crucial piece is bullet #3, because thread-signal will not
> interrupt the pselect call.  And if we are not too lucky, the pselect
> call could have been made with a long timeout.  So this is the first
> obstacle to negotiate.

Yes. There is quit_throw_to_read_char, but this would quit the (main)
thread, which is not what we want.

> So what means do we have to interrupt a pselect call from another
> thread?
>
> (I'm not sure I understand why you thought we'd need bullet #2, btw.
> Once we interrupt the pselect call, the main thread should become
> stuck trying to take the global lock, so I don't think we need any
> trickery here, because the other thread, which is running, will have
> arranged for it to be the current thread.)

Shouldn't there be several read_char calls in parallel? Bullet #2 is
just a machinery to switch to the main thread, that's all. If we could
manipulate the main thread from inside current thread, we wouldn't need this.

> Thanks.

Best regards, Michael.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#25214: 26.0.50; Interacting with user from threads other than the primary
Resent-From: Michael Albinus <michael.albinus@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 18 Sep 2018 08:30:02 +0000
Resent-Message-ID: <handler.25214.B25214.153725939132762 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 25214
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: 25214 <at> debbugs.gnu.org, tom@HIDDEN
Received: via spool by 25214-submit <at> debbugs.gnu.org id=B25214.153725939132762
          (code B ref 25214); Tue, 18 Sep 2018 08:30:02 +0000
Received: (at 25214) by debbugs.gnu.org; 18 Sep 2018 08:29:51 +0000
Received: from localhost ([127.0.0.1]:43602 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1g2BOI-0008WM-N9
	for submit <at> debbugs.gnu.org; Tue, 18 Sep 2018 04:29:50 -0400
Received: from mout.gmx.net ([212.227.17.21]:45693)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael.albinus@HIDDEN>) id 1g2BOH-0008W4-BM
 for 25214 <at> debbugs.gnu.org; Tue, 18 Sep 2018 04:29:49 -0400
Received: from detlef.gmx.de ([212.86.62.20]) by mail.gmx.com (mrgmx102
 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MWhRH-1gIQeB2uB1-00XxNB; Tue, 18
 Sep 2018 10:29:28 +0200
From: Michael Albinus <michael.albinus@HIDDEN>
References: <837f6z9a4x.fsf@HIDDEN> <87zhwguskw.fsf@HIDDEN>
 <83fty8ge50.fsf@HIDDEN> <83efdsgcqv.fsf@HIDDEN>
Date: Tue, 18 Sep 2018 10:29:25 +0200
In-Reply-To: <83efdsgcqv.fsf@HIDDEN> (Eli Zaretskii's message of "Mon, 17 Sep
 2018 22:11:52 +0300")
Message-ID: <875zz3mcnu.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:m5am4uy0NPKesgu/4C3GDz/5JzIkWYj5XYoUYWCsPLgTN7h2Cm+
 4cmEACnH/+B5eyhpdKYAfcMaZFDVyPKeKfKDCqc/nAarLAAR4zVeGEuBEsMLCsyQA1H42rg
 3vPJZZQcFve1FgWrodEy1iGttUnCLO4KkHV6oh6/HAnguouKmKv+stly6cC7D0WazlyTYpl
 wIQZjS/WemX+WhYcQnnQA==
X-UI-Out-Filterresults: notjunk:1;V01:K0:W/efz1QkSYM=:BOlNX+iDRw9mDcQOeF6Qd2
 kwzoWw7/Fl4hGj1t/CWeoPm32/P61IUlUU2ire0yG5m1AorAIf1ke5eaE4MGBZ5I+EGGhe9Zw
 3gmpuysFnMTjiVRUvuFA6npTCZVlah7kf3QJNHZFFdTnc05yox4HMuJyTdJelpeEKL17hr5wI
 HwHdnDoXCHBxAzoWgrOA868+4w4fogAkRX1hEoAdwjMF7/Cb/Y2IReM1Oyl8G2DDZi6JZG/l2
 MTKIqtuTtXFmroGRAOk75NeKKZNe0N236HhcNgfyrUiWXDkdqjfErwf+Ig6Q8hzqfoEfiIsrq
 tb7qtHBJ1yrhsfIwPIQHnCnf1XpD5RFCdTVtrefOmriL2HUMWtMcYbI7WAhZMYvew6PL1lH5N
 gtacMnk+sbn4rCQ9l8VK/BHqqBCeViu7NMG7ExDN/uwEImumXYIWnODapkm8eVVv59iKf5HZw
 Y4S1HZBV2VDKsPVrxlP41QJtaHhdGPk7iWzkzXsbGVw6Zy+lcmYZh5RNPr8PCFaEzdNUUevRb
 0TaI6owmm3haKv4zjL8PJH90i1oeI4Gb2iwXL5FN3aUaGRWVtw88lSqHXaZcpBBaPqIH/e18D
 rAg7WsrUNEIumhF5JYCpRLqLJONleCAPFv2F65ElwIyaUlxcejPjjv6wJZhQjqnfGED1PQ9cB
 T4vxdEJ1XUkUr4AFG9ipjy6vnmZhCMYYu74SLf6ulZbT+JFvjeDWlrLO5yCs5Pr4Ofr3/Iz6y
 AdZjfZz5Rhxm3stB4Z2j01z8hP41VK8q7kdLnBK9xSGNGxYW9BTG4TpFYPRQ+nHSZxIKw9Use
 jxccmlB8gHsVNq+dfhtDivsNI4dPVhc9x0mU5kIzu7SxUP6NK8=
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

>> 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.

I'll see whether I could implement something along this idea. But I'm
still learning Emacs' keyboard (more general: FD) handling, so it will
take time.

For waiting of the non-main thread: maybe a mutex and/or condition
variable could do the job.

Best regards, Michael.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#25214: 26.0.50; Interacting with user from threads other than the primary
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 18 Sep 2018 08:36:02 +0000
Resent-Message-ID: <handler.25214.B25214.1537259716917 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 25214
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Michael Albinus <michael.albinus@HIDDEN>
Cc: 25214 <at> debbugs.gnu.org, tom@HIDDEN
Received: via spool by 25214-submit <at> debbugs.gnu.org id=B25214.1537259716917
          (code B ref 25214); Tue, 18 Sep 2018 08:36:02 +0000
Received: (at 25214) by debbugs.gnu.org; 18 Sep 2018 08:35:16 +0000
Received: from localhost ([127.0.0.1]:43606 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1g2BTY-0000Ej-EP
	for submit <at> debbugs.gnu.org; Tue, 18 Sep 2018 04:35:16 -0400
Received: from eggs.gnu.org ([208.118.235.92]:51960)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1g2BTW-0000EW-F6
 for 25214 <at> debbugs.gnu.org; Tue, 18 Sep 2018 04:35:14 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1g2BTK-0005xc-21
 for 25214 <at> debbugs.gnu.org; Tue, 18 Sep 2018 04:35:08 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled
 version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:39858)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1g2BSz-0005VT-UR; Tue, 18 Sep 2018 04:34:43 -0400
Received: from [176.228.60.248] (port=1266 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1g2BSz-0004vk-4q; Tue, 18 Sep 2018 04:34:41 -0400
Date: Tue, 18 Sep 2018 11:34:36 +0300
Message-Id: <834lengq5f.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-reply-to: <875zz3mcnu.fsf@HIDDEN> (message from Michael Albinus on Tue, 18
 Sep 2018 10:29:25 +0200)
References: <837f6z9a4x.fsf@HIDDEN> <87zhwguskw.fsf@HIDDEN>
 <83fty8ge50.fsf@HIDDEN> <83efdsgcqv.fsf@HIDDEN> <875zz3mcnu.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.0 (------)

> From: Michael Albinus <michael.albinus@HIDDEN>
> Cc: 25214 <at> debbugs.gnu.org,  tom@HIDDEN
> Date: Tue, 18 Sep 2018 10:29:25 +0200
> 
> > 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.
> 
> I'll see whether I could implement something along this idea. But I'm
> still learning Emacs' keyboard (more general: FD) handling, so it will
> take time.

It might help to search for timeout_reduced_for_timers in process.c:
that's how we implement a similar logic when timers are waiting to
run.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#25214: 26.0.50; Interacting with user from threads other than the primary
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 18 Sep 2018 12:35:01 +0000
Resent-Message-ID: <handler.25214.B25214.1537274058928 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 25214
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Michael Albinus <michael.albinus@HIDDEN>
Cc: 25214 <at> debbugs.gnu.org, tom@HIDDEN
Received: via spool by 25214-submit <at> debbugs.gnu.org id=B25214.1537274058928
          (code B ref 25214); Tue, 18 Sep 2018 12:35:01 +0000
Received: (at 25214) by debbugs.gnu.org; 18 Sep 2018 12:34:18 +0000
Received: from localhost ([127.0.0.1]:43770 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1g2FCr-0000Et-Qb
	for submit <at> debbugs.gnu.org; Tue, 18 Sep 2018 08:34:18 -0400
Received: from eggs.gnu.org ([208.118.235.92]:60201)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1g2FCq-0000Ei-RL
 for 25214 <at> debbugs.gnu.org; Tue, 18 Sep 2018 08:34:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1g2FCk-0002IV-Mc
 for 25214 <at> debbugs.gnu.org; Tue, 18 Sep 2018 08:34:11 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled
 version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:43895)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1g2FCK-0001fE-Us; Tue, 18 Sep 2018 08:33:48 -0400
Received: from [176.228.60.248] (port=4247 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1g2FCJ-00040P-49; Tue, 18 Sep 2018 08:33:44 -0400
Date: Tue, 18 Sep 2018 15:33:32 +0300
Message-Id: <83sh27f0ir.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-reply-to: <87a7ofmd0w.fsf@HIDDEN> (message from Michael Albinus on Tue, 18
 Sep 2018 10:21:35 +0200)
References: <837f6z9a4x.fsf@HIDDEN> <87zhwguskw.fsf@HIDDEN>
 <83fty8ge50.fsf@HIDDEN> <87a7ofmd0w.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.0 (------)

> From: Michael Albinus <michael.albinus@HIDDEN>
> Cc: 25214 <at> debbugs.gnu.org,  tom@HIDDEN
> Date: Tue, 18 Sep 2018 10:21:35 +0200
> 
> > (I'm not sure I understand why you thought we'd need bullet #2, btw.
> > Once we interrupt the pselect call, the main thread should become
> > stuck trying to take the global lock, so I don't think we need any
> > trickery here, because the other thread, which is running, will have
> > arranged for it to be the current thread.)
> 
> Shouldn't there be several read_char calls in parallel? Bullet #2 is
> just a machinery to switch to the main thread, that's all. If we could
> manipulate the main thread from inside current thread, we wouldn't need this.

I think we arrived at the conclusion that simultaneous calls to
read_char should be avoided.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#25214: 26.0.50; Interacting with user from threads other than the primary
Resent-From: Michael Albinus <michael.albinus@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 27 Sep 2018 16:16:01 +0000
Resent-Message-ID: <handler.25214.B25214.153806493317613 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 25214
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: 25214 <at> debbugs.gnu.org, tom@HIDDEN
Received: via spool by 25214-submit <at> debbugs.gnu.org id=B25214.153806493317613
          (code B ref 25214); Thu, 27 Sep 2018 16:16:01 +0000
Received: (at 25214) by debbugs.gnu.org; 27 Sep 2018 16:15:33 +0000
Received: from localhost ([127.0.0.1]:56806 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1g5Ywv-0004a1-9g
	for submit <at> debbugs.gnu.org; Thu, 27 Sep 2018 12:15:33 -0400
Received: from mout.gmx.net ([212.227.17.22]:55171)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael.albinus@HIDDEN>) id 1g5Ywt-0004Zm-J1
 for 25214 <at> debbugs.gnu.org; Thu, 27 Sep 2018 12:15:32 -0400
Received: from detlef.gmx.de ([79.140.120.188]) by mail.gmx.com (mrgmx103
 [212.227.17.168]) with ESMTPSA (Nemesis) id 0LgZ7h-1fQmks3S1V-00nzwM; Thu, 27
 Sep 2018 18:15:12 +0200
Received: from detlef.gmx.de ([79.140.120.188]) by mail.gmx.com (mrgmx103
 [212.227.17.168]) with ESMTPSA (Nemesis) id 0LgZ7h-1fQmks3S1V-00nzwM; Thu, 27
 Sep 2018 18:15:12 +0200
From: Michael Albinus <michael.albinus@HIDDEN>
References: <837f6z9a4x.fsf@HIDDEN> <87zhwguskw.fsf@HIDDEN>
 <83fty8ge50.fsf@HIDDEN> <83efdsgcqv.fsf@HIDDEN>
 <875zz3mcnu.fsf@HIDDEN> <834lengq5f.fsf@HIDDEN>
Date: Thu, 27 Sep 2018 18:15:08 +0200
In-Reply-To: <834lengq5f.fsf@HIDDEN> (Eli Zaretskii's message of "Tue, 18 Sep
 2018 11:34:36 +0300")
Message-ID: <87o9ciapdf.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:gyjZUTZ1MytKsVfA4dDMyCQba5uiOu+5yEbSCBG1ctaqsWD5qwT
 69wA0iYBs96WQlL+9/Iq4WG8/xXtsg/2MXj8C7+qeMf0ghE25+IdsMdf2Arh0Rd1gjYRmpn
 jBfRKOuoWYL9ewRKF0RcB3dIGwUEgp5O8mc03+TTzeMzvEHEEGT1eOsVRBP3h92Tm+feMPP
 7/F9XGcpjNv2dDDVI2zwQ==
X-UI-Out-Filterresults: notjunk:1;V01:K0:4+DBCPlpc0Q=:qxK947ZS0wWNa+/3DyG6p0
 li5Hih9FxOlTP1WaEfjDwTw0YbyER4DMb879N4KsNkNfZwn1+dIQz6uVS7L6hIvxlbONRbypy
 HVdIhogtnE7IX/HqENoSUCCcYUJf2nTDyyKWqkularBA+rv8NuO2biESqM6Tn8HaBP+NhIdzS
 o/egVJV1Eo07f4LVszhASvVioug/bhsn1Q3lG0GThpwf0M9UomqPDGKmjRvzKUrM5ocTWIr2f
 XFMIyTxqhknLbo8JZV1HXVqMACyrcumjnKBrbqi1s0fGG5rRBtda4zkEfJd8zkea13CK4xn7F
 3qsIeci8TJWygRgOcJEDSfhmHl5TSPbxnPvGjCcmzweV69D+5KxW0JWiOirTrsKe2gp7gtvOy
 ZzY4BLigF03+YwsG3AfUvTcO/4UwL2fWTA6owi7EBf6WhZbyfG7o/W1nMLX6vYEUWrddg5UXx
 gQyv2JoxF4lXh0BrP4frtG5K7+QK4r+dUubYpkzly2i9NEqyVoRpEnZACtH8RV2Dk0VxAxd7V
 9tNyz9sohd/bScOvLLgb78KKKkpaLC3zK45U0l8B8gmjJ5aZLgJ23JVoeoqQ+PkV5ke4MPAMx
 WqSt+gWEr6zEhDn2vYNATRlkJASfqnZrXn3nuBrMECPxTtiFwfrls+8sYW1oRPTguKeEthpv+
 dr0gvKQvh46GzteimkVO6fPTht1yGYVVzXq1trtmWmtjoMsjA3tTPj7r0oIDqHq44zCdF3oZU
 bqsNtKnyH+p/CJjO0K2yMhVWgUA3iVy8VVyNGa9WybA+bdERwAemAQvUKxiZuWYqnjB3fVFWJ
 UJ8n6vOypIm/m/PMl5sk3OuK0xkq/8Y2JiTHTqgDJg0+CpRz/A=
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

Hi Eli,

>> > 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.
>> 
>> I'll see whether I could implement something along this idea. But I'm
>> still learning Emacs' keyboard (more general: FD) handling, so it will
>> take time.
>
> It might help to search for timeout_reduced_for_timers in process.c:
> that's how we implement a similar logic when timers are waiting to
> run.

I've played for a while with the keyboard related code, and I must
confess I'm too dumb for this. Sorry, but it is too much, and I have the
feeling I cannot contribute something useful in this area. So I let this
to be fixed by somebody else. This is a pity, because it blocks further
progress in merging the branch feature/tramp-thread-safe into master.

For the time being I concentrate on tasks I feel better suited, like
adding thread support for further file operations.

Best regards, Michael.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#25214: 26.0.50; Interacting with user from threads other than the primary
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 27 Sep 2018 16:21:01 +0000
Resent-Message-ID: <handler.25214.B25214.153806525518161 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 25214
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Michael Albinus <michael.albinus@HIDDEN>
Cc: 25214 <at> debbugs.gnu.org, tom@HIDDEN
Received: via spool by 25214-submit <at> debbugs.gnu.org id=B25214.153806525518161
          (code B ref 25214); Thu, 27 Sep 2018 16:21:01 +0000
Received: (at 25214) by debbugs.gnu.org; 27 Sep 2018 16:20:55 +0000
Received: from localhost ([127.0.0.1]:56822 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1g5Z26-0004ir-TM
	for submit <at> debbugs.gnu.org; Thu, 27 Sep 2018 12:20:55 -0400
Received: from eggs.gnu.org ([208.118.235.92]:39496)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1g5Z24-0004ic-Ox
 for 25214 <at> debbugs.gnu.org; Thu, 27 Sep 2018 12:20:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1g5Z1v-0006om-Cv
 for 25214 <at> debbugs.gnu.org; Thu, 27 Sep 2018 12:20:47 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled
 version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52516)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1g5Z1d-0006be-7j; Thu, 27 Sep 2018 12:20:25 -0400
Received: from [176.228.60.248] (port=1115 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1g5Z1b-0003Xq-MV; Thu, 27 Sep 2018 12:20:25 -0400
Date: Thu, 27 Sep 2018 19:20:02 +0300
Message-Id: <83o9ci7w0d.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-reply-to: <87o9ciapdf.fsf@HIDDEN> (message from Michael Albinus on Thu, 27
 Sep 2018 18:15:08 +0200)
References: <837f6z9a4x.fsf@HIDDEN> <87zhwguskw.fsf@HIDDEN>
 <83fty8ge50.fsf@HIDDEN> <83efdsgcqv.fsf@HIDDEN>
 <875zz3mcnu.fsf@HIDDEN> <834lengq5f.fsf@HIDDEN> <87o9ciapdf.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -6.0 (------)

> From: Michael Albinus <michael.albinus@HIDDEN>
> Cc: 25214 <at> debbugs.gnu.org,  tom@HIDDEN
> Date: Thu, 27 Sep 2018 18:15:08 +0200
> 
> >> > 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.
> >> 
> >> I'll see whether I could implement something along this idea. But I'm
> >> still learning Emacs' keyboard (more general: FD) handling, so it will
> >> take time.
> >
> > It might help to search for timeout_reduced_for_timers in process.c:
> > that's how we implement a similar logic when timers are waiting to
> > run.
> 
> I've played for a while with the keyboard related code, and I must
> confess I'm too dumb for this. Sorry, but it is too much, and I have the
> feeling I cannot contribute something useful in this area. So I let this
> to be fixed by somebody else. This is a pity, because it blocks further
> progress in merging the branch feature/tramp-thread-safe into master.

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?

Thanks.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#25214: 26.0.50; Interacting with user from threads other than the primary
In-Reply-To: <837f6z9a4x.fsf@HIDDEN>
Resent-From: Michael Albinus <michael.albinus@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 28 Sep 2018 11:10:02 +0000
Resent-Message-ID: <handler.25214.B25214.15381329776629 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 25214
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: 25214 <at> debbugs.gnu.org, tom@HIDDEN
Received: via spool by 25214-submit <at> debbugs.gnu.org id=B25214.15381329776629
          (code B ref 25214); Fri, 28 Sep 2018 11:10:02 +0000
Received: (at 25214) by debbugs.gnu.org; 28 Sep 2018 11:09:37 +0000
Received: from localhost ([127.0.0.1]:57245 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1g5qeP-0001ir-6B
	for submit <at> debbugs.gnu.org; Fri, 28 Sep 2018 07:09:37 -0400
Received: from mout.gmx.net ([212.227.15.15]:49745)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael.albinus@HIDDEN>) id 1g5qeN-0001ia-9a
 for 25214 <at> debbugs.gnu.org; Fri, 28 Sep 2018 07:09:35 -0400
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
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
From: Michael Albinus <michael.albinus@HIDDEN>
References: <837f6z9a4x.fsf@HIDDEN> <87zhwguskw.fsf@HIDDEN>
 <83fty8ge50.fsf@HIDDEN> <83efdsgcqv.fsf@HIDDEN>
 <875zz3mcnu.fsf@HIDDEN> <834lengq5f.fsf@HIDDEN>
 <87o9ciapdf.fsf@HIDDEN> <83o9ci7w0d.fsf@HIDDEN>
Date: Fri, 28 Sep 2018 13:09:12 +0200
Message-ID: <87r2hdho9z.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
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+UAY0jbZcHqBr76BBvND3EgkSkV
 h0C1g+rFUj9qWxkI7dpYtcgMm66+vc6AQktCxboFVqb/FbafV4=
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> 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.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#25214: #25214 26.0.50; Interacting with user from threads other than the primary
References: <837f6z9a4x.fsf@HIDDEN>
In-Reply-To: <837f6z9a4x.fsf@HIDDEN>
Resent-From: Zhang Haijun <ccsmile2008@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 06 Feb 2019 06:59:02 +0000
Resent-Message-ID: <handler.25214.B25214.154943633430770 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 25214
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: "25214 <at> debbugs.gnu.org" <25214 <at> debbugs.gnu.org>
Received: via spool by 25214-submit <at> debbugs.gnu.org id=B25214.154943633430770
          (code B ref 25214); Wed, 06 Feb 2019 06:59:02 +0000
Received: (at 25214) by debbugs.gnu.org; 6 Feb 2019 06:58:54 +0000
Received: from localhost ([127.0.0.1]:33949 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1grHAb-00080E-U1
	for submit <at> debbugs.gnu.org; Wed, 06 Feb 2019 01:58:54 -0500
Received: from mail-oln040092254019.outbound.protection.outlook.com
 ([40.92.254.19]:36448 helo=APC01-PU1-obe.outbound.protection.outlook.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ccsmile2008@HIDDEN>) id 1grHAa-0007zx-Hc
 for 25214 <at> debbugs.gnu.org; Wed, 06 Feb 2019 01:58:53 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=En+kZ6O12ZQMsLK9oDJgLqp9Bknx7QVEjXyzaMHjH2w=;
 b=EtXpxMiwnqwg/a/bWiKKA1sVEmEzD0IXQ/M5mUVwOoT/4imGN/KWkFHjcw4t5zMNNjwJZdSE3kMqppi9+leZi5WeBSqCnQZ2vL0hbFAUg/9ymgB/X+ux37kpP3lspGSE7M0g6IGD6HFdM+uslGMRRwAH0jwxYt1MtSbXDdP65HAp4SArPTT1Teig5Ft0WGuRor8bztujZ8KasApyoMTL3couHylwCDqoCrdKHK+7HQp0UyL1e5kI2AqbqM1yP78vtVoPNJ60SYxkZHmiDSoP2vITEi8jOHi0sjGQ0mxKQi4ngsfUTcqdl+sfE+1mbscnJ9RcPo2UUNzLXa1QnFh4+A==
Received: from PU1APC01FT051.eop-APC01.prod.protection.outlook.com
 (10.152.252.51) by PU1APC01HT003.eop-APC01.prod.protection.outlook.com
 (10.152.252.117) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1580.10; Wed, 6 Feb
 2019 06:58:44 +0000
Received: from PS1PR06MB2759.apcprd06.prod.outlook.com (10.152.252.55) by
 PU1APC01FT051.mail.protection.outlook.com (10.152.253.146) with Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.1580.10 via Frontend Transport; Wed, 6 Feb 2019 06:58:44 +0000
Received: from PS1PR06MB2759.apcprd06.prod.outlook.com
 ([fe80::f148:4bb6:5470:d6c]) by PS1PR06MB2759.apcprd06.prod.outlook.com
 ([fe80::f148:4bb6:5470:d6c%3]) with mapi id 15.20.1580.019; Wed, 6 Feb 2019
 06:58:44 +0000
From: Zhang Haijun <ccsmile2008@HIDDEN>
Thread-Topic: #25214 26.0.50; Interacting with user from threads other than
 the primary
Thread-Index: AQHUvelmem56QfVTqEeQonXUHfBOXQ==
Date: Wed, 6 Feb 2019 06:58:44 +0000
Message-ID: <PS1PR06MB275922160EA3DA04C433888EA86F0@HIDDEN>
Accept-Language: zh-CN, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-clientproxiedby: HK0PR03CA0088.apcprd03.prod.outlook.com
 (2603:1096:203:72::28) To PS1PR06MB2759.apcprd06.prod.outlook.com
 (2603:1096:803:46::13)
x-incomingtopheadermarker: OriginalChecksum:DD373CDBF01CCDA44DC92FA481423F4545C67BF3083CD371A0A96761AA22E89B;
 UpperCasedChecksum:B18DD5739FD6738E0CCB5924AE1055695209CA13A7A0EBB6A4772FBE05D1F24E;
 SizeAsReceived:8415; Count:62
x-ms-exchange-messagesentrepresentingtype: 1
x-mailer: Apple Mail (2.3445.9.1)
x-tmn: [DDurh0bKxqUITPPqzo8qYEAaI4jAU28q]
x-microsoft-original-message-id: <EAC06A30-CA25-4803-9FBB-3C032DA8923B@HIDDEN>
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; PU1APC01HT003;
 6:ZNPNkJruDiuDhABy7rBLPhw6T5l4i+iazxhX6MBL5IUC16Z1LNjbzJTV9/TY03b7UfZDo9M61LrP6+pFYkA1WrsiTFLY6CO6kkd4T8RWv/bvt+Fqr1HB600eShxFKUfWcxmoSwpuBqb3+vsIdDCkoQr02KjuONp4WiwteGdvVgyj8/g2CnVGzSgGmJulNwrOkc4m9fxTQkMIBTMmfApQ4mMswpYxlbXnAa0FoHvVNEC8hgYq5WlBtwA6E3GUkAh+Kvw8M+99dQaoeqEI5TLjDlbM8cHfxpmaQVRVEaUNkmqmpALvDe7dLgs7P07jeQQJijGRnPtbZU5ttCYWb19TVRkRV/pLB1BTPAGsBTTgVW5z53FMAvarHkPsqIUCWvPPSwnt4yRlh4HRWre5xThUQaEsy80q3CFOFryakkCBbc4pLKx4NMu7k3MqnoMCSDACI16uT/WCIlh7N5T+r1YKNg==;
 5:9f5Xwt4IRLIAc4d3ALG9g3oBHkPDz4QC0Ut+HgvbsUDHLNKuJ3S9kpz5N76mFcj6ETEF4r6M13zkCOgr5OK0DfDuCB5lx36hBa98WUzhSVHRpmEV5d1EONqHmBNGQ+hEM9q6fXoqwFG9Yb4N1DQqB5eJLybzM9bB8VziStRnTSqPicxwWEqQcSnI9lg94zYBL35ViifvtZui8eit+R4tUw==;
 7:ct81yzBfcDq2uHbrhg9VStNf8XmAeIQZZ80rVIeOvGYctW3wEONbPX0ZIqgIde+Y8j75hvShCgrtI52k2IPmeqyOco4yB5HdP933AOGfWaaomKHoSNpNCuqoddakg3loWrMn7hsqVTx17ZjkNngwwg==
x-incomingheadercount: 62
x-eopattributedmessage: 0
x-microsoft-antispam: BCL:0; PCL:0;
 RULEID:(2390118)(7020095)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031323274)(2017031324274)(2017031322404)(1601125500)(1603101475)(1701031045);
 SRVR:PU1APC01HT003; 
x-ms-traffictypediagnostic: PU1APC01HT003:
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(4566010)(82015058);
 SRVR:PU1APC01HT003; BCL:0; PCL:0; RULEID:; SRVR:PU1APC01HT003; 
x-microsoft-antispam-message-info: lkLi46mguodG0tYbC4gBlhjnpOdV9+VBMKGWF0f041efS8mgTbAdiHARWCOC/IFf
Content-Type: text/plain; charset="gb2312"
Content-ID: <3BE8322F249B944794605953532CB9F8@HIDDEN>
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-OriginatorOrg: outlook.com
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 54485d23-c432-40fe-8436-6091d627118c
X-MS-Exchange-CrossTenant-Network-Message-Id: 610b07a2-3475-4d79-9b02-08d68c008901
X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 54485d23-c432-40fe-8436-6091d627118c
X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Feb 2019 06:58:44.2704 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Internet
X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PU1APC01HT003
X-Spam-Score: 0.2 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

RXZlcnkgaW5wdXR0aW5nIHJlcXVlc3QgZnJvbSBvdGhlciB0aHJlYWRzIGNhbiBiZSB0cmVhdGVk
IGxpa2UgYW4gZW1haWwuIEVtYWNzIHB1dHMgYWxsIHJlcXVlc3RlcyBpbiBpbi1ib3ggYW5kIHNo
b3cgYSBub3RpZmljYXRpb24gaWNvbihvciBudW1iZXIpIG9uIG1vZGUtbGluZS4gVGhlbiB1c2Vy
IGNhbiBvcGVuIHRoZSBpbi1ib3ggdG8gcHJvY2VzcyBhbiBlbWFpbChpbnB1dHRpbmcgcmVxdWVz
dCkuIEZvciBleGFtcGxlIHVzZXIgY2FuIHJ1biBhIGNvbW1hbmQgbGlrZSBgbGlzdC1pbnB1dHRp
bmctcmVxdWVzdGAgdG8gb3BlbiBhIGJ1ZmZlciB0byBzaG93IGFsbCBpbnB1dHRpbmcgcmVxdWVz
dGVzLiBVc2VyIGNhbiBjaG9vc2UgYW55IHJlcXVlc3QgdG8gcHJvY2Vzcy4gSWYgYW4gaW5wdXR0
aW5nIHJlcXVlc3QgaXMgY2hvc2VuIGJ5IHVzZXIsIHRoZW4gRW1hY3Mgc3dpdGNoZXMgdG8gdGhl
IHRocmVhZCB0byBwcm9jZXNzIHRoZSBpbnB1dHRpbmcuIA==




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#25214: #25214 26.0.50; Interacting with user from threads other than the primary
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 06 Feb 2019 15:42:01 +0000
Resent-Message-ID: <handler.25214.B25214.15494676799586 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 25214
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Zhang Haijun <ccsmile2008@HIDDEN>
Cc: 25214 <at> debbugs.gnu.org
Received: via spool by 25214-submit <at> debbugs.gnu.org id=B25214.15494676799586
          (code B ref 25214); Wed, 06 Feb 2019 15:42:01 +0000
Received: (at 25214) by debbugs.gnu.org; 6 Feb 2019 15:41:19 +0000
Received: from localhost ([127.0.0.1]:36085 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1grPKB-0002UY-6U
	for submit <at> debbugs.gnu.org; Wed, 06 Feb 2019 10:41:19 -0500
Received: from eggs.gnu.org ([209.51.188.92]:45044)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1grPKA-0002UN-Bz
 for 25214 <at> debbugs.gnu.org; Wed, 06 Feb 2019 10:41:18 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:42819)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1grPK4-00027C-TE; Wed, 06 Feb 2019 10:41:12 -0500
Received: from [176.228.60.248] (port=1120 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1grPK4-0002bA-Fs; Wed, 06 Feb 2019 10:41:12 -0500
Date: Wed, 06 Feb 2019 17:41:05 +0200
Message-Id: <83zhr8sz5a.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-reply-to: <PS1PR06MB275922160EA3DA04C433888EA86F0@HIDDEN>
 (message from Zhang Haijun on Wed, 6 Feb 2019 06:58:44 +0000)
References: <837f6z9a4x.fsf@HIDDEN>
 <PS1PR06MB275922160EA3DA04C433888EA86F0@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

> From: Zhang Haijun <ccsmile2008@HIDDEN>
> Date: Wed, 6 Feb 2019 06:58:44 +0000
> 
> Every inputting request from other threads can be treated like an email.

The problem is in receiving the input into Emacs in the first place.
It has to be done by some thread, not necessarily the one that is
executing when input arrives.  So we are back to square one.

Thanks.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#25214: #25214 26.0.50; Interacting with user from threads other than the primary
Resent-From: Zhang Haijun <ccsmile2008@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 07 Feb 2019 01:41:02 +0000
Resent-Message-ID: <handler.25214.B25214.15495036079162 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 25214
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: "25214 <at> debbugs.gnu.org" <25214 <at> debbugs.gnu.org>
Received: via spool by 25214-submit <at> debbugs.gnu.org id=B25214.15495036079162
          (code B ref 25214); Thu, 07 Feb 2019 01:41:02 +0000
Received: (at 25214) by debbugs.gnu.org; 7 Feb 2019 01:40:07 +0000
Received: from localhost ([127.0.0.1]:36409 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1grYfe-0002Ng-Nt
	for submit <at> debbugs.gnu.org; Wed, 06 Feb 2019 20:40:07 -0500
Received: from mail-oln040092254103.outbound.protection.outlook.com
 ([40.92.254.103]:54381 helo=APC01-PU1-obe.outbound.protection.outlook.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ccsmile2008@HIDDEN>) id 1grYfa-0002N2-AN
 for 25214 <at> debbugs.gnu.org; Wed, 06 Feb 2019 20:40:05 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=B1lanq5wSA0+WL4AqpWw0NaAWoJI9B5hpodDZQN62F8=;
 b=eGAII2rrwPRhV1OzIs0AZgyA4BTuYUAcFpLni5ZL68PGTcIWYnE+ZKqP6MlOT1KgBLhGeLwC07QoWEzhLWFyQeFbL99u/ri/MrDzYPPpr5z9/PFjLhHaZJgOjyH6bzUsWFmHJK00I9UF+xZ0RmwLvXlrYqgAFE9bnT0d+FSOcgFMSWIF3MLnx9aJ9qG5jNZV00LSwvb+IVp/f/PPSNnGdJ05IyiLozY6nP+Bsq8C7214cR65+PgkQBWTYCkIAOdGcUWlFmfvOacpSjSkzPNAUFcD97cJKrTcB22gJmJ+zJKLiaa6kxzk185ti9sPs276w4X9wvGm9RhoknWmodggRQ==
Received: from HK2APC01FT056.eop-APC01.prod.protection.outlook.com
 (10.152.248.54) by HK2APC01HT151.eop-APC01.prod.protection.outlook.com
 (10.152.249.114) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1580.10; Thu, 7 Feb
 2019 01:39:54 +0000
Received: from PS1PR06MB2759.apcprd06.prod.outlook.com (10.152.248.56) by
 HK2APC01FT056.mail.protection.outlook.com (10.152.249.67) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id
 15.20.1580.10 via Frontend Transport; Thu, 7 Feb 2019 01:39:54 +0000
Received: from PS1PR06MB2759.apcprd06.prod.outlook.com
 ([fe80::f148:4bb6:5470:d6c]) by PS1PR06MB2759.apcprd06.prod.outlook.com
 ([fe80::f148:4bb6:5470:d6c%3]) with mapi id 15.20.1601.016; Thu, 7 Feb 2019
 01:39:54 +0000
From: Zhang Haijun <ccsmile2008@HIDDEN>
Thread-Topic: bug#25214: #25214 26.0.50; Interacting with user from threads
 other than the primary
Thread-Index: AQHUvoYGgunCiAtnGE6RDXpfPfjS0Q==
Date: Thu, 7 Feb 2019 01:39:54 +0000
Message-ID: <PS1PR06MB275990CE5DFE9F68C2EB06DCA8680@HIDDEN>
References: <837f6z9a4x.fsf@HIDDEN>
 <PS1PR06MB275922160EA3DA04C433888EA86F0@HIDDEN>
 <83zhr8sz5a.fsf@HIDDEN>
In-Reply-To: <83zhr8sz5a.fsf@HIDDEN>
Accept-Language: zh-CN, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-clientproxiedby: HK2PR02CA0220.apcprd02.prod.outlook.com
 (2603:1096:201:20::32) To PS1PR06MB2759.apcprd06.prod.outlook.com
 (2603:1096:803:46::13)
x-incomingtopheadermarker: OriginalChecksum:2E58ACFD33726138B963A2E942A4DB76F9079D720AA3B5F46A3AA111F899CB11;
 UpperCasedChecksum:6EB73D49838B8B4AE76EFAA068B012113B6930A0B15B2CC8AEBA648CCD4DF889;
 SizeAsReceived:8662; Count:65
x-ms-exchange-messagesentrepresentingtype: 1
x-mailer: Apple Mail (2.3445.9.1)
x-tmn: [DVlfxZNL6eHC7UGPzORIlekrB4S79UDp]
x-microsoft-original-message-id: <D55AF9DD-D8D2-4A59-AE6D-24B597A164C1@HIDDEN>
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; HK2APC01HT151;
 6:ON1mj4kcvsLKtVEphDVxbtxaHFTUALR3/fCdJKNceM8A+mLSrUCpSulVUS95g9KiJ/V7SUuKWVVd18FwxLeCpc9lyn/y7FXvQ/PlKdv0M+NdV52NgmVzCHbU6wX5ArCeidNb7m3IrlQKJYXm5yEvEBha6t0zIucb7V660FrFNXwfOtzHUn2jGt7rjh1EcJsdNBZJqfzvGZDZUd3zZTSmf9YNK5f1sZQ+sAa+NMZ8IIWWleXOYCdBhB+g7TNdjLIKjwjCeVS9oEvXBkpHDLLOGm/uyiJa8Tnf9smaG9zre2lDeqZtgPOT/7NBn3ZxnuFwxRkfqWpv5ZkyrfJuXafK7LlDuxbzxFyiYNd4lw3JcBLng6BmzXy5BtvF58f2+WKf/GDcp0CIwg2lHN+sQZCY3oIwr2QwDSSLyi2mmSUGjOUzgK+RCrULrKVZtBxWTAd2E1KoohkbyRhXfaIBu5ZD5w==;
 5:puvD8F94NAoaQMNAORZthJx64soWOsVmbRNodF1xEat8Epsgaim7YxdlaTwHyN3dlnJV+SEuFBpvgsUQjKkAxVYM+JcjjgTyPUmgZW/08WoOatqsCinpfUvkrVaFl5ob6jSY0LNL2pKJ5JzkSzwwZlAJiVrpAauXX092R20DfEOIpOYCshswPrgyt/WUCxDEOuv2VbMBvHgwCQKC97wqrw==;
 7:jkGH3z8+r1X0/bcTAhaMz/ZQDG7xwYxVz7vmLT216YLGNJ8X/vxD1b3nUwyxo4Q2wsceevrUUejK95sDatm1VnG/KDhpbbeXt1dH0RxiSA/BLi1jdMc+wwq/Z6ixUcTjQBrYLonY+IkMmerCfm+Etw==
x-incomingheadercount: 65
x-eopattributedmessage: 0
x-microsoft-antispam: BCL:0; PCL:0;
 RULEID:(2390118)(7020095)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031323274)(2017031324274)(2017031322404)(1601125500)(1603101475)(1701031045);
 SRVR:HK2APC01HT151; 
x-ms-traffictypediagnostic: HK2APC01HT151:
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(4566010)(82015058);
 SRVR:HK2APC01HT151; BCL:0; PCL:0; RULEID:; SRVR:HK2APC01HT151; 
x-microsoft-antispam-message-info: 9DWKZtJBsJpEp+baIBA3jgGp58UytZQWsEk7rtNSedrxD65XuVEP8+R8y+HArKoV
Content-Type: text/plain; charset="gb2312"
Content-ID: <D89851BC310ACB439E2F6E8F00716352@HIDDEN>
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-OriginatorOrg: outlook.com
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 54485d23-c432-40fe-8436-6091d627118c
X-MS-Exchange-CrossTenant-Network-Message-Id: 7a06fe5d-5e78-46d6-f834-08d68c9d28ab
X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 54485d23-c432-40fe-8436-6091d627118c
X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Feb 2019 01:39:53.5754 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Internet
X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2APC01HT151
X-Spam-Score: 0.2 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

DQoNCj4g1NogMjAxOcTqMtTCNsjVo6zPws7nMTE6NDGjrEVsaSBaYXJldHNraWkgPGVsaXpAZ251
Lm9yZz4g0LS1wKO6DQo+IA0KPj4gRnJvbTogWmhhbmcgSGFpanVuIDxjY3NtaWxlMjAwOEBvdXRs
b29rLmNvbT4NCj4+IERhdGU6IFdlZCwgNiBGZWIgMjAxOSAwNjo1ODo0NCArMDAwMA0KPj4gDQo+
PiBFdmVyeSBpbnB1dHRpbmcgcmVxdWVzdCBmcm9tIG90aGVyIHRocmVhZHMgY2FuIGJlIHRyZWF0
ZWQgbGlrZSBhbiBlbWFpbC4NCj4gDQo+IFRoZSBwcm9ibGVtIGlzIGluIHJlY2VpdmluZyB0aGUg
aW5wdXQgaW50byBFbWFjcyBpbiB0aGUgZmlyc3QgcGxhY2UuDQo+IEl0IGhhcyB0byBiZSBkb25l
IGJ5IHNvbWUgdGhyZWFkLCBub3QgbmVjZXNzYXJpbHkgdGhlIG9uZSB0aGF0IGlzDQo+IGV4ZWN1
dGluZyB3aGVuIGlucHV0IGFycml2ZXMuICBTbyB3ZSBhcmUgYmFjayB0byBzcXVhcmUgb25lLg0K
PiANCj4gVGhhbmtzLg0KDQpXaGF0IGFib3V0IHRoZSBmb2xsb3dpbmc6DQoNCjEuIENyZWF0ZSBh
IGZkIHRvIHJlY2VpdmUgdGhlIGlucHV0IHJlcXVlc3QgZXZlbnQuIFRoaXMgZmQgY2FuIG9ubHkg
YmUgd2F0Y2hlZCBieSBtYWluIHRocmVhZCBvciBhIHNwZWNpYWwga2V5Ym9yZCBzaGVkdWxlciB0
aHJlYWQuDQoyLiBJZiBhIHRocmVhZCBuZWVkIGlucHV0LCBpdCBzZW5kcyBhbiBpbnB1dCByZXF1
ZXN0IGV2ZW50KGNvbnRhaW5uaW5nIGl0cyB0aHJlYWQgaWQsIHByb21wdCChrSkgdG8gdGhlIGZk
IGFuZCB0aGVuIGdvdG8gYmFja2dyb3VuZC4NCjMuIFRoZSBtYWluIHRocmVhZChvciBrZXlib2Fy
ZCBzaGVkdWxlciB0aHJlYWQpIHJlY2VpdmVzIHRoZSBldmVudCBhbmQgcHV0IGl0IGludG8gaW4t
Ym94IGFuZCBzaG93IGEgbm90aWZpY2F0aW9uIHRvIHVzZXIuDQo0LiBVc2VyIG9wZW5zIHRoZSBp
bi1ib3ggYW5kIHNlbGVjdHMgYSByZXF1ZXN0LiBFbWFjcyBzd2l0Y2hlcyB0byB0aGUgdGhyZWFk
Lg0KDQpJoa9tIG5vdCB0b28gZmFtaWxhciB3aXRoIGVtYWNzoa8gaW50ZXJuYWwuIE1heWJlIEmh
r20gd3Jvbmcu




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#25214: #25214 26.0.50; Interacting with user from threads other than the primary
Resent-From: Zhang Haijun <ccsmile2008@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 07 Feb 2019 13:50:01 +0000
Resent-Message-ID: <handler.25214.B25214.154954737230460 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 25214
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: "25214 <at> debbugs.gnu.org" <25214 <at> debbugs.gnu.org>
Received: via spool by 25214-submit <at> debbugs.gnu.org id=B25214.154954737230460
          (code B ref 25214); Thu, 07 Feb 2019 13:50:01 +0000
Received: (at 25214) by debbugs.gnu.org; 7 Feb 2019 13:49:32 +0000
Received: from localhost ([127.0.0.1]:36653 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1grk3Y-0007vE-5j
	for submit <at> debbugs.gnu.org; Thu, 07 Feb 2019 08:49:32 -0500
Received: from mail-oln040092254027.outbound.protection.outlook.com
 ([40.92.254.27]:8519 helo=APC01-PU1-obe.outbound.protection.outlook.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ccsmile2008@HIDDEN>) id 1grk3V-0007ux-9O
 for 25214 <at> debbugs.gnu.org; Thu, 07 Feb 2019 08:49:30 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=aMaqHklZnWnWiFOAHPGV9N0gApnkDgtbqMHaFccBTjI=;
 b=NY32NHnTS6wezILa4aL93kBJMBeumtnMSP7QEq7JWkXV0BrWs5ZuyF1SoYQKQQM/Hzxp7GNQuu0bLmtaNgkSqtCG+fGqS3ahJNpfdSfdu/2UbK97tGn974hJ8UDPSGIUezrRfX9m7ZPmkdgL65hLGH+q9wZvHprtW91GmIKJDHaHVsHIuXyVE8vIXR0YbAjXOy7XP49Vti+xOdgRBELw1SHj81qy29Ve1Bxo2/HBL1pZ4XauXWeOUyq8OPRGK9tnDs9AqaaDty4laMevq1nAWY2rMwORMlelLv8jXXwwGs4q1w/aiDuBEnFSHEaCWgvkU8PJ/6P20g0b0c3q8WeZKQ==
Received: from HK2APC01FT024.eop-APC01.prod.protection.outlook.com
 (10.152.248.59) by HK2APC01HT154.eop-APC01.prod.protection.outlook.com
 (10.152.249.117) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1580.10; Thu, 7 Feb
 2019 13:49:21 +0000
Received: from PS1PR06MB2759.apcprd06.prod.outlook.com (10.152.248.57) by
 HK2APC01FT024.mail.protection.outlook.com (10.152.248.147) with Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id
 15.20.1580.10 via Frontend Transport; Thu, 7 Feb 2019 13:49:21 +0000
Received: from PS1PR06MB2759.apcprd06.prod.outlook.com
 ([fe80::f148:4bb6:5470:d6c]) by PS1PR06MB2759.apcprd06.prod.outlook.com
 ([fe80::f148:4bb6:5470:d6c%3]) with mapi id 15.20.1601.016; Thu, 7 Feb 2019
 13:49:20 +0000
From: Zhang Haijun <ccsmile2008@HIDDEN>
Thread-Topic: bug#25214: #25214 26.0.50; Interacting with user from threads
 other than the primary
Thread-Index: AQHUvoYG62myD/qcakyPc2fhgfZyp6XUWseA
Date: Thu, 7 Feb 2019 13:49:20 +0000
Message-ID: <PS1PR06MB2759CEBAA9C3B5730A16E864A8680@HIDDEN>
References: <837f6z9a4x.fsf@HIDDEN>
 <PS1PR06MB275922160EA3DA04C433888EA86F0@HIDDEN>
 <83zhr8sz5a.fsf@HIDDEN> <D55AF9DD-D8D2-4A59-AE6D-24B597A164C1@HIDDEN>
In-Reply-To: <D55AF9DD-D8D2-4A59-AE6D-24B597A164C1@HIDDEN>
Accept-Language: zh-CN, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-clientproxiedby: HK0PR01CA0070.apcprd01.prod.exchangelabs.com
 (2603:1096:203:a6::34) To PS1PR06MB2759.apcprd06.prod.outlook.com
 (2603:1096:803:46::13)
x-incomingtopheadermarker: OriginalChecksum:3ADD1A51EF84F23BD5F30C32B15EB2A9F85630C906E88FC3C4DD1F4334DC3F5B;
 UpperCasedChecksum:1BD05C346B50C9B2BA968615BA1BCB42988677A2A9F3944BD503AC4CCC44B9BD;
 SizeAsReceived:8751; Count:65
x-ms-exchange-messagesentrepresentingtype: 1
x-mailer: Apple Mail (2.3445.9.1)
x-tmn: [bNWpODDuJw16fyDwMR8dN7nS0E5JZLN8]
x-microsoft-original-message-id: <5D70982F-8FFB-4EAE-9139-9D642D4389C1@HIDDEN>
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; HK2APC01HT154;
 6:BX7q+/BA7Q73NYPgqzr8MpsFNBDauI+UZpBE6EIDoXdEHQSdwK0RjS2CSF3ZwZCFtXea3k+n828hdrFmfs5auP7m1XyrYgJOicK2+mtQ0bvMG765DQ45ME5s3YPDQJyPjkBtLElPmUjv8eHozcOLztg0MqqXojv+NX9RJpbeyXoagiTI80cufhe4fELTAWm4sk5QtLicIeR44BCX22OPmvZiKYmMs9ewp1xDMVpCVSNxBLkXsQxPwvlNAcAAHk9HW6vaWmpe2VugRdHLvM8B/1l6WmSmwrOdBU2xjReGSuvEfDfzNijMW22FiSIrgMFBnMmM+W4ifF3NTKtenTaCHrhRBxq1+5kR2Cb2QRfcWqwQfYkRFCJZpO9pt2GI49/jn+lVG9AIW1pzzFP4FgcDQ1lWVMMMy6pY5HsX4X+KECWl4u/X0zNPVo17xwPNUT6UvdRtyxiBlj7o6PzzSGZejQ==;
 5:7fty6KX600HinZyTpVd0/oAtzTIIjRUlBy7CpdEnGxmcVUnybyDIX7MIsgb9tsJVOCOhosDEKCGULQrsv9KlpBi5Y8m2SEtYcnhbd/UgENQoB6SSTOyeFuLxkUkrgzcAk1ogE+qHb9OaO6SgFjTIvWZH/u3PfE7rkEQ+vTdphO6g+ePgX8t9uJSRsFi+g9VWT65+85G77qnUgMz8PKbKew==;
 7:woAP2JtbCeUVYrqjMNBEbjG2P8Kg5/y4nwjas55MilkPNP/KN+pgha1431VZds682uSh0oNHWicyEBnk9homG80okranqpEtzI0zf5c2rtleQ1FPeroWpl9/EEKoaG8IwhYtZlyjNgGI1H8AMLVQnQ==
x-incomingheadercount: 65
x-eopattributedmessage: 0
x-microsoft-antispam: BCL:0; PCL:0;
 RULEID:(2390118)(7020095)(20181119070)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031323274)(2017031324274)(2017031322404)(1601125500)(1603101475)(1701031045);
 SRVR:HK2APC01HT154; 
x-ms-traffictypediagnostic: HK2APC01HT154:
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(4566010)(82015058);
 SRVR:HK2APC01HT154; BCL:0; PCL:0; RULEID:; SRVR:HK2APC01HT154; 
x-microsoft-antispam-message-info: vimano/a9Zq/rJX2ZuGG+9lGuqgRS0tBbExGmWZVFPDPbQzJZ17qEK37KaNOfS7Q
Content-Type: text/plain; charset="gb2312"
Content-ID: <F0F04C5A27CA834091059D39C6FBA2F8@HIDDEN>
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-OriginatorOrg: outlook.com
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 54485d23-c432-40fe-8436-6091d627118c
X-MS-Exchange-CrossTenant-Network-Message-Id: ac3f046e-2b93-4ede-5736-08d68d030f81
X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 54485d23-c432-40fe-8436-6091d627118c
X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Feb 2019 13:49:19.1778 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Internet
X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2APC01HT154
X-Spam-Score: 0.2 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

DQoNCj4g1NogMjAxOcTqMtTCN8jVo6zJz87nOTozOaOs1cW6o779IDxjY3NtaWxlMjAwOEBvdXRs
b29rLmNvbT4g0LS1wKO6DQo+IA0KPiAxLiBDcmVhdGUgYSBmZCB0byByZWNlaXZlIHRoZSBpbnB1
dCByZXF1ZXN0IGV2ZW50LiBUaGlzIGZkIGNhbiBvbmx5IGJlIHdhdGNoZWQgYnkgbWFpbiB0aHJl
YWQgb3IgYSBzcGVjaWFsIGtleWJvcmQgc2hlZHVsZXIgdGhyZWFkLg0KDQpUaGUgZmQgbWF5IGJl
IGEgc29ja2V0IGNyZWF0ZWQgYnkgc29ja2V0cGFpcigpLg0KDQo=




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#25214: #25214 26.0.50; Interacting with user from threads other than the primary
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 07 Feb 2019 14:31:02 +0000
Resent-Message-ID: <handler.25214.B25214.15495498091650 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 25214
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Zhang Haijun <ccsmile2008@HIDDEN>
Cc: 25214 <at> debbugs.gnu.org
Received: via spool by 25214-submit <at> debbugs.gnu.org id=B25214.15495498091650
          (code B ref 25214); Thu, 07 Feb 2019 14:31:02 +0000
Received: (at 25214) by debbugs.gnu.org; 7 Feb 2019 14:30:09 +0000
Received: from localhost ([127.0.0.1]:36670 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1grkgq-0000QX-JL
	for submit <at> debbugs.gnu.org; Thu, 07 Feb 2019 09:30:08 -0500
Received: from eggs.gnu.org ([209.51.188.92]:50440)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1grkgm-0000Pi-5Z
 for 25214 <at> debbugs.gnu.org; Thu, 07 Feb 2019 09:30:04 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:52132)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1grkgg-0005bj-Pb; Thu, 07 Feb 2019 09:29:58 -0500
Received: from [176.228.60.248] (port=2295 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1grkgg-00060Y-DY; Thu, 07 Feb 2019 09:29:58 -0500
Date: Thu, 07 Feb 2019 16:29:54 +0200
Message-Id: <838syrsmcd.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-reply-to: <PS1PR06MB275990CE5DFE9F68C2EB06DCA8680@HIDDEN>
 (message from Zhang Haijun on Thu, 7 Feb 2019 01:39:54 +0000)
References: <837f6z9a4x.fsf@HIDDEN>
 <PS1PR06MB275922160EA3DA04C433888EA86F0@HIDDEN>
 <83zhr8sz5a.fsf@HIDDEN>
 <PS1PR06MB275990CE5DFE9F68C2EB06DCA8680@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=gb2312
Content-Transfer-Encoding: 8bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

> From: Zhang Haijun <ccsmile2008@HIDDEN>
> CC: "25214 <at> debbugs.gnu.org" <25214 <at> debbugs.gnu.org>
> Date: Thu, 7 Feb 2019 01:39:54 +0000
> 
> 1. Create a fd to receive the input request event. This fd can only be watched by main thread or a special keybord sheduler thread.
> 2. If a thread need input, it sends an input request event(containning its thread id, prompt бн) to the fd and then goto background.

How do you "send input request to the fd"?  A program cannot both read
and write to the same fd within the same process, at least not
portably.

> 3. The main thread(or keyboard sheduler thread) receives the event and put it into in-box and show a notification to user.

If another thread writes to some fd, it means the main thread is not
running, so it cannot receive the event, even if we did find the way
of having an fd which can be read by one thread and written by all the
others.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#25214: #25214 26.0.50; Interacting with user from threads other than the primary
Resent-From: Zhang Haijun <ccsmile2008@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 07 Feb 2019 14:57:02 +0000
Resent-Message-ID: <handler.25214.B25214.15495513945927 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 25214
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: "25214 <at> debbugs.gnu.org" <25214 <at> debbugs.gnu.org>
Received: via spool by 25214-submit <at> debbugs.gnu.org id=B25214.15495513945927
          (code B ref 25214); Thu, 07 Feb 2019 14:57:02 +0000
Received: (at 25214) by debbugs.gnu.org; 7 Feb 2019 14:56:34 +0000
Received: from localhost ([127.0.0.1]:38530 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1grl6P-0001XX-N9
	for submit <at> debbugs.gnu.org; Thu, 07 Feb 2019 09:56:33 -0500
Received: from mail-oln040092254107.outbound.protection.outlook.com
 ([40.92.254.107]:6168 helo=APC01-PU1-obe.outbound.protection.outlook.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ccsmile2008@HIDDEN>) id 1grl6N-0001XP-Op
 for 25214 <at> debbugs.gnu.org; Thu, 07 Feb 2019 09:56:32 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=11z+1tyx3Trm2YPuPbEzcTNiG1DQ/k0euuE4yv5Qavw=;
 b=Zkw4g71JVa/lwO5vCYnjcyGUk+XwMKqiFElkgXVFnXVywUcVfpj1xvyvaVd0PquwmEzzrRRrV5Nbg18v4gs+8ZwMdPz/a0FBuqGk8yCnkxM/i/VAIq5FIvMX2mxmQRjF7pWMxFoWZsbcM8euQ/X7ZVcHlRLFCU86N76rALcEu2iImpI/7y8vjwETa6a/tNmrWOvI14r2Z0zdFLqVCaTEIKkaWmYS0pLNgfrHpDB8AMNowhvMRd6UPGPcen4IQmGHio1ERY1sBy+v60LdPgzYeGN8RP/1V6Z1AnrtwZnchDC77CyuTlAF++JTNleaLCyhR39B1A6ZXnpUlT+2hwO6wQ==
Received: from PU1APC01FT048.eop-APC01.prod.protection.outlook.com
 (10.152.252.60) by PU1APC01HT007.eop-APC01.prod.protection.outlook.com
 (10.152.252.101) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1580.10; Thu, 7 Feb
 2019 14:56:23 +0000
Received: from PS1PR06MB2759.apcprd06.prod.outlook.com (10.152.252.60) by
 PU1APC01FT048.mail.protection.outlook.com (10.152.253.79) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.1580.10 via Frontend Transport; Thu, 7 Feb 2019 14:56:22 +0000
Received: from PS1PR06MB2759.apcprd06.prod.outlook.com
 ([fe80::f148:4bb6:5470:d6c]) by PS1PR06MB2759.apcprd06.prod.outlook.com
 ([fe80::f148:4bb6:5470:d6c%3]) with mapi id 15.20.1601.016; Thu, 7 Feb 2019
 14:56:22 +0000
From: Zhang Haijun <ccsmile2008@HIDDEN>
Thread-Topic: bug#25214: #25214 26.0.50; Interacting with user from threads
 other than the primary
Thread-Index: AQHUvoYGgunCiAtnGE6RDXpfPfjS0aXUZiyjgAAHVwA=
Date: Thu, 7 Feb 2019 14:56:22 +0000
Message-ID: <PS1PR06MB2759F409501F337334342C7AA8680@HIDDEN>
References: <837f6z9a4x.fsf@HIDDEN>
 <PS1PR06MB275922160EA3DA04C433888EA86F0@HIDDEN>
 <83zhr8sz5a.fsf@HIDDEN>
 <PS1PR06MB275990CE5DFE9F68C2EB06DCA8680@HIDDEN>
 <838syrsmcd.fsf@HIDDEN>
In-Reply-To: <838syrsmcd.fsf@HIDDEN>
Accept-Language: zh-CN, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-clientproxiedby: HK0PR03CA0096.apcprd03.prod.outlook.com
 (2603:1096:203:72::36) To PS1PR06MB2759.apcprd06.prod.outlook.com
 (2603:1096:803:46::13)
x-incomingtopheadermarker: OriginalChecksum:ED053F82CC6C98725BDDA001D92E1167113746EF854CD77944B9B620FA39C367;
 UpperCasedChecksum:99293EEE61690C3F281BD22F515CA92B376D2898FC9A61E4AD3609130F76AB92;
 SizeAsReceived:8799; Count:65
x-ms-exchange-messagesentrepresentingtype: 1
x-mailer: Apple Mail (2.3445.9.1)
x-tmn: [rXt/eVF21FTVXYlKoe0CBD7NG7Mlg9Sa]
x-microsoft-original-message-id: <4683F324-2124-4002-A6E0-CECB5035F040@HIDDEN>
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; PU1APC01HT007;
 6:0gGFcN10oQAbK64K8YVwfTslUaw0INVoYwIQSQ7H+x5tKUwBQ61b4uilrOYzUTWdEw1ojdsM2QmgkRcmjS140m3xk3iBz2kX9va1FdZjQEz+c+l9bGCCJfM4Qd9lnyRI+TIFITaAaBZ9n8o8U5gJ3QopDYePMn44QozNF+C9CCffm9SewetgeWom++z6TNv1TfwuG+aH8Ko31TlnP7EWzHxIeih5eupAtZgu22oGFDa4WZ/lEGJLrtOpS/nMPGdJf4F6gvyPCU7EwBGNhcJ2AgXYxHwhVEM3RR4a1r+9BU/52AFpKxN5ZwDt33oCXKYwC5X5l6f54dYbccd7gY0/SvXzKZjGg1uVvDWTV0UDgk1LKFKfpZ4z5FA247HPBQXRbMgaLgiyhDkqtSLYQHg0R7zzbGh6wcDV0cQqtKGPwS9RaS+yS0uYyyaocDNftkdAj2DiUkwDN04GQXFWSqDTow==;
 5:+hVK7UMpXEO4syao21pfuWltT3PcxrfgUIyXOOKIEzveLjbVN74NPFiDYN4OynYrzwxrv3Jftl1iV0K1Ug4UgpfacwKG4HyNhR51IBTtiUcXvUguhZtxE5xvFB13bQWGhRgYokC/JwsnwLgPIQVfYKHWRIuHOoE97foyTwNn1eeszTGTV9oBFZthGAVxXEYvM5PUZ/ZJDb6Z7funbfLqYA==;
 7:7LCVPYlwNMJGy1BxfePLMmUs9DTRj8dJmYjexkHS5+MjER8RMcJYTUNdn5z5BBjndDQ3odlDaLMRpHFPIpWjBusftzXI/Ezv15vS+rTdKPwDkUSEZhyNPIqAFeHAZP9uitqNhqoGY870FQ8wEVFoiA==
x-incomingheadercount: 65
x-eopattributedmessage: 0
x-microsoft-antispam: BCL:0; PCL:0;
 RULEID:(2390118)(7020095)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031323274)(2017031324274)(2017031322404)(1601125500)(1603101475)(1701031045);
 SRVR:PU1APC01HT007; 
x-ms-traffictypediagnostic: PU1APC01HT007:
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(4566010)(82015058);
 SRVR:PU1APC01HT007; BCL:0; PCL:0; RULEID:; SRVR:PU1APC01HT007; 
x-microsoft-antispam-message-info: uoKO5alUL77DmMY/NlqnGdPn6M+q4aBQd1hFAD3se5daodGbxCCPX2ORXa86oU1o
Content-Type: text/plain; charset="gb2312"
Content-ID: <E8EA76A44C9F404FB9FC5BF031442258@HIDDEN>
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-OriginatorOrg: outlook.com
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 54485d23-c432-40fe-8436-6091d627118c
X-MS-Exchange-CrossTenant-Network-Message-Id: 20b6ab35-00f8-4488-5231-08d68d0c6cfb
X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 54485d23-c432-40fe-8436-6091d627118c
X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Feb 2019 14:56:22.2704 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Internet
X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PU1APC01HT007
X-Spam-Score: 0.2 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

DQoNCj4g1NogMjAxOcTqMtTCN8jVo6zPws7nMTA6MjmjrEVsaSBaYXJldHNraWkgPGVsaXpAZ251
Lm9yZz4g0LS1wKO6DQo+IA0KPiBIb3cgZG8geW91ICJzZW5kIGlucHV0IHJlcXVlc3QgdG8gdGhl
IGZkIj8gIEEgcHJvZ3JhbSBjYW5ub3QgYm90aCByZWFkDQo+IGFuZCB3cml0ZSB0byB0aGUgc2Ft
ZSBmZCB3aXRoaW4gdGhlIHNhbWUgcHJvY2VzcywgYXQgbGVhc3Qgbm90DQo+IHBvcnRhYmx5Lg0K
PiANCg0KU29ycnkgZm9yIG15IHBvb3IgRW5nbGlzaCBhbmQgcG9vciBleHByZXNzaW9uLiBJIG1l
YW4gYSBkYXRhIGNoYW5uZWwsIGZvciBleGFtcGxlIGEgcGFpciBvZiBmZCBjcmVhdGVkIGJ5IHBp
cGUoKSBvciBhIHBhaXIgb2Ygc29ja2V0cyBjcmVhdGVkIGJ5IHNvY2tldHBhaXIoKS4gcHJvZHVj
ZXItY29uc3VtZXIgbW9kZWwuDQoNCj4gSWYgYW5vdGhlciB0aHJlYWQgd3JpdGVzIHRvIHNvbWUg
ZmQsIGl0IG1lYW5zIHRoZSBtYWluIHRocmVhZCBpcyBub3QNCj4gcnVubmluZywgc28gaXQgY2Fu
bm90IHJlY2VpdmUgdGhlIGV2ZW50LCBldmVuIGlmIHdlIGRpZCBmaW5kIHRoZSB3YXkNCj4gb2Yg
aGF2aW5nIGFuIGZkIHdoaWNoIGNhbiBiZSByZWFkIGJ5IG9uZSB0aHJlYWQgYW5kIHdyaXR0ZW4g
YnkgYWxsIHRoZQ0KPiBvdGhlcnMuDQoNCkFub3RoZXIgdGhyZWFkIHNlbmQgYSBpbnB1dCByZXF1
ZXN0IGFuZCB0aGVuIGJlIGJsb2NrZWQgb24gYSBsb2NrKGZvciBleGFtcGxlLCBrZXlib3JkIGxv
Y2ssIG9uZSBsb2NrIHBlciB0aHJlYWQpLiBUaGUgbWFpbiB0aHJlYWQob3Iga2V5Ym9yZCBzaGVk
dWxlciB0aHJlYWQpIHRoZW4gY2FuIHdha2UgdXAgb25lIHRocmVhZCBhbmQgZ2l2ZSBrZXlib3Jk
IHRvIGl0Lg0KDQo=




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#25214: #25214 26.0.50; Interacting with user from threads other than the primary
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 07 Feb 2019 17:27:01 +0000
Resent-Message-ID: <handler.25214.B25214.154956036320653 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 25214
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Zhang Haijun <ccsmile2008@HIDDEN>
Cc: 25214 <at> debbugs.gnu.org
Received: via spool by 25214-submit <at> debbugs.gnu.org id=B25214.154956036320653
          (code B ref 25214); Thu, 07 Feb 2019 17:27:01 +0000
Received: (at 25214) by debbugs.gnu.org; 7 Feb 2019 17:26:03 +0000
Received: from localhost ([127.0.0.1]:38601 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1grnR5-0005N2-Iz
	for submit <at> debbugs.gnu.org; Thu, 07 Feb 2019 12:26:03 -0500
Received: from eggs.gnu.org ([209.51.188.92]:36214)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1grnR3-0005MY-OK
 for 25214 <at> debbugs.gnu.org; Thu, 07 Feb 2019 12:26:02 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:56168)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1grnQy-0004jP-E4; Thu, 07 Feb 2019 12:25:56 -0500
Received: from [176.228.60.248] (port=1303 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1grnQy-0004aV-1c; Thu, 07 Feb 2019 12:25:56 -0500
Date: Thu, 07 Feb 2019 19:25:51 +0200
Message-Id: <83tvhfqzmo.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-reply-to: <PS1PR06MB2759F409501F337334342C7AA8680@HIDDEN>
 (message from Zhang Haijun on Thu, 7 Feb 2019 14:56:22 +0000)
References: <837f6z9a4x.fsf@HIDDEN>
 <PS1PR06MB275922160EA3DA04C433888EA86F0@HIDDEN>
 <83zhr8sz5a.fsf@HIDDEN>
 <PS1PR06MB275990CE5DFE9F68C2EB06DCA8680@HIDDEN>
 <838syrsmcd.fsf@HIDDEN>
 <PS1PR06MB2759F409501F337334342C7AA8680@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

> From: Zhang Haijun <ccsmile2008@HIDDEN>
> CC: "25214 <at> debbugs.gnu.org" <25214 <at> debbugs.gnu.org>
> Date: Thu, 7 Feb 2019 14:56:22 +0000
> 
> 
> Sorry for my poor English and poor expression. I mean a data channel, for example a pair of fd created by pipe() or a pair of sockets created by socketpair(). producer-consumer model.
> 
> > If another thread writes to some fd, it means the main thread is not
> > running, so it cannot receive the event, even if we did find the way
> > of having an fd which can be read by one thread and written by all the
> > others.
> 
> Another thread send a input request and then be blocked on a lock(for example, keybord lock, one lock per thread). The main thread(or keybord sheduler thread) then can wake up one thread and give keybord to it.

Unless the thread that listens to these requests is never blocked, I
don't see how this could work.

And in any case, what should a non-main thread do if it wants to ask a
question?  Asking a question involves displaying the question before
reading the answer.  You only talked about the second part.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#25214: #25214 26.0.50; Interacting with user from threads other than the primary
Resent-From: Zhang Haijun <ccsmile2008@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 08 Feb 2019 02:43:02 +0000
Resent-Message-ID: <handler.25214.B25214.154959375317336 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 25214
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: "25214 <at> debbugs.gnu.org" <25214 <at> debbugs.gnu.org>
Received: via spool by 25214-submit <at> debbugs.gnu.org id=B25214.154959375317336
          (code B ref 25214); Fri, 08 Feb 2019 02:43:02 +0000
Received: (at 25214) by debbugs.gnu.org; 8 Feb 2019 02:42:33 +0000
Received: from localhost ([127.0.0.1]:38742 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1grw7d-0004VY-CA
	for submit <at> debbugs.gnu.org; Thu, 07 Feb 2019 21:42:33 -0500
Received: from mail-oln040092255074.outbound.protection.outlook.com
 ([40.92.255.74]:43136 helo=APC01-HK2-obe.outbound.protection.outlook.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ccsmile2008@HIDDEN>) id 1grw7a-0004VH-S9
 for 25214 <at> debbugs.gnu.org; Thu, 07 Feb 2019 21:42:32 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=4nURA8YE32WVi5YMEuLgJKA0WD9Pgr7WmrlqR2VMQpk=;
 b=EWkfwHYEJNxFisEzaMC924TtC3FTQq2ZFwLKw98MeMAvqgW8AMUKn9itqApTX3n/zNzdoYJ6/S/2xcJWfzwugnurW2mdwJW5BemafzXcDAHtWNMiVN7MXvHzGKR1LHzU8MT622PgF4h7R7nETLADCQGlQCfBtB11dBl4SayykVi1/B3RxZtwW5iTOxftXZk/+XnXRFrciKD5fBsdrtzACuk1fmfXJXmpsvFiZji0RVBmexY8VcdZ/NB65ca3aGKqIqjG9M+FrOvxEldsvfi6Te8VAHovwFtiVp0v8KIVbuGj6H2CIGA03GaUeMebpFDo6v4mXQglniLpD/F2Fgg9wg==
Received: from PU1APC01FT044.eop-APC01.prod.protection.outlook.com
 (10.152.252.52) by PU1APC01HT125.eop-APC01.prod.protection.outlook.com
 (10.152.253.39) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1580.10; Fri, 8 Feb
 2019 02:42:22 +0000
Received: from PS1PR06MB2759.apcprd06.prod.outlook.com (10.152.252.51) by
 PU1APC01FT044.mail.protection.outlook.com (10.152.253.20) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id
 15.20.1580.10 via Frontend Transport; Fri, 8 Feb 2019 02:42:22 +0000
Received: from PS1PR06MB2759.apcprd06.prod.outlook.com
 ([fe80::f148:4bb6:5470:d6c]) by PS1PR06MB2759.apcprd06.prod.outlook.com
 ([fe80::f148:4bb6:5470:d6c%3]) with mapi id 15.20.1601.016; Fri, 8 Feb 2019
 02:42:22 +0000
From: Zhang Haijun <ccsmile2008@HIDDEN>
Thread-Topic: bug#25214: #25214 26.0.50; Interacting with user from threads
 other than the primary
Thread-Index: AQHUvoYGgunCiAtnGE6RDXpfPfjS0aXUZiyjgAAHVwCAACnS24AAm3EA
Date: Fri, 8 Feb 2019 02:42:22 +0000
Message-ID: <PS1PR06MB2759A53476B32FBE71A43C9FA8690@HIDDEN>
References: <837f6z9a4x.fsf@HIDDEN>
 <PS1PR06MB275922160EA3DA04C433888EA86F0@HIDDEN>
 <83zhr8sz5a.fsf@HIDDEN>
 <PS1PR06MB275990CE5DFE9F68C2EB06DCA8680@HIDDEN>
 <838syrsmcd.fsf@HIDDEN>
 <PS1PR06MB2759F409501F337334342C7AA8680@HIDDEN>
 <83tvhfqzmo.fsf@HIDDEN>
In-Reply-To: <83tvhfqzmo.fsf@HIDDEN>
Accept-Language: zh-CN, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-clientproxiedby: HK2PR02CA0199.apcprd02.prod.outlook.com
 (2603:1096:201:20::11) To PS1PR06MB2759.apcprd06.prod.outlook.com
 (2603:1096:803:46::13)
x-incomingtopheadermarker: OriginalChecksum:D344B0C4AFF375008AC21820A48E79D98F03204335722BAFC794D3108A42142E;
 UpperCasedChecksum:D501D97B137223F93FD9F8B2ED390361BC978934429607E38B6BDE8432269F97;
 SizeAsReceived:8908; Count:65
x-ms-exchange-messagesentrepresentingtype: 1
x-mailer: Apple Mail (2.3445.9.1)
x-tmn: [IhwR/R/I52XzL83uAYlNBbZjjkuN5M6R]
x-microsoft-original-message-id: <79C95AA1-D921-4D74-AA07-2C545BE6D7C6@HIDDEN>
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; PU1APC01HT125;
 6:1ZPq7ej/fOQUJatp0V89ZpHOJfg1QELsMp9NeIOTMsqP+4gdYvh1i4eicpkdNt+RQXNiP95u89xdtZtV13mfBUupqrOq7Ya0GQ1USP0iO8PFrjt9HH/ESB13cKsQmXD3Zr6izkVLtIHpENgFflNdyFObB7yfWSyY5/pQNeZ1/JDZCOuZ4SUFxv1Kv9EC1dNFBshyHA+Qu4JgnbB3s8EMeSJCjdFMvQbQQNuP4V9Z//RVPPDQXwu5SzjJKfz26pJXv73TQZx9mazVzydKbV8CM5ZXWw5zm9xr8fMCFRvctWiNH5/AZ2lxl9fvSnsJhX0figTiYSdNargtKg3aSvWQw4++7VCWUOtXiDFvyXbA7hRCuYTAvlID2AULKUOD403qcOwRc0WTpUPniLOx9C/nmAtm4SuHHOiEpjMhKM1CKTDw/lynIB5OAtqQbUKwwyRI8IBQobUPpZwRmnsbXHva1g==;
 5:tYMaEB4BOVVEpUCE+oKysm2au2UHxeFKtWSoLsergVn3i5/m+0MuIYMYMnfbxyfq2dc/tEUtcgkmCD0Aw+EbQI0AQduO+TPEyHD1ol3gqdtbVr2dkURWNhwlO6ZCwoYdRbmjxlUk/7I5JRFbn7wQHzR4/IWQCEvI6UMxqxc4yEW2Xi1BgkIFEXRNcKVAWtsBHDMiajZiE3IG0P6a5kscYg==;
 7:CJ/xfk9ZXG1nAWdWWEWbEvxRG22PQpDvERg5697Mc/AskwfW8tW2NTUAfs1SlN3m4U/wxFCK3oR3AH0NTvgVZlwR3faXjhKTzH6VxzkR9FR2Dm91jXgqRv8jt/tZx1HGGTnO+2958M9qbyNmaXQZMA==
x-incomingheadercount: 65
x-eopattributedmessage: 0
x-microsoft-antispam: BCL:0; PCL:0;
 RULEID:(2390118)(7020095)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031323274)(2017031324274)(2017031322404)(1601125500)(1603101475)(1701031045);
 SRVR:PU1APC01HT125; 
x-ms-traffictypediagnostic: PU1APC01HT125:
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(4566010)(82015058);
 SRVR:PU1APC01HT125; BCL:0; PCL:0; RULEID:; SRVR:PU1APC01HT125; 
x-microsoft-antispam-message-info: 8sUP65sVF1wcUCbLueQi/EIaFjpKH686X7+r8gTR0eGLATRMB8PSA/DA5XsFzRFo
Content-Type: text/plain; charset="gb2312"
Content-ID: <A11926B0DEBDE543882AF00B747D3236@HIDDEN>
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-OriginatorOrg: outlook.com
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 54485d23-c432-40fe-8436-6091d627118c
X-MS-Exchange-CrossTenant-Network-Message-Id: 27ec8c99-43d8-4d3d-6097-08d68d6f0d7b
X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 54485d23-c432-40fe-8436-6091d627118c
X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Feb 2019 02:42:22.2446 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Internet
X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PU1APC01HT125
X-Spam-Score: 0.2 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

DQoNCj4g1NogMjAxOcTqMtTCOMjVo6zJz87nMToyNaOsRWxpIFphcmV0c2tpaSA8ZWxpekBnbnUu
b3JnPiDQtLXAo7oNCj4gDQo+PiBGcm9tOiBaaGFuZyBIYWlqdW4gPGNjc21pbGUyMDA4QG91dGxv
b2suY29tPg0KPj4gQ0M6ICIyNTIxNEBkZWJidWdzLmdudS5vcmciIDwyNTIxNEBkZWJidWdzLmdu
dS5vcmc+DQo+PiBEYXRlOiBUaHUsIDcgRmViIDIwMTkgMTQ6NTY6MjIgKzAwMDANCj4+IA0KPj4g
DQo+PiBTb3JyeSBmb3IgbXkgcG9vciBFbmdsaXNoIGFuZCBwb29yIGV4cHJlc3Npb24uIEkgbWVh
biBhIGRhdGEgY2hhbm5lbCwgZm9yIGV4YW1wbGUgYSBwYWlyIG9mIGZkIGNyZWF0ZWQgYnkgcGlw
ZSgpIG9yIGEgcGFpciBvZiBzb2NrZXRzIGNyZWF0ZWQgYnkgc29ja2V0cGFpcigpLiBwcm9kdWNl
ci1jb25zdW1lciBtb2RlbC4NCj4+IA0KPj4+IElmIGFub3RoZXIgdGhyZWFkIHdyaXRlcyB0byBz
b21lIGZkLCBpdCBtZWFucyB0aGUgbWFpbiB0aHJlYWQgaXMgbm90DQo+Pj4gcnVubmluZywgc28g
aXQgY2Fubm90IHJlY2VpdmUgdGhlIGV2ZW50LCBldmVuIGlmIHdlIGRpZCBmaW5kIHRoZSB3YXkN
Cj4+PiBvZiBoYXZpbmcgYW4gZmQgd2hpY2ggY2FuIGJlIHJlYWQgYnkgb25lIHRocmVhZCBhbmQg
d3JpdHRlbiBieSBhbGwgdGhlDQo+Pj4gb3RoZXJzLg0KPj4gDQo+PiBBbm90aGVyIHRocmVhZCBz
ZW5kIGEgaW5wdXQgcmVxdWVzdCBhbmQgdGhlbiBiZSBibG9ja2VkIG9uIGEgbG9jayhmb3IgZXhh
bXBsZSwga2V5Ym9yZCBsb2NrLCBvbmUgbG9jayBwZXIgdGhyZWFkKS4gVGhlIG1haW4gdGhyZWFk
KG9yIGtleWJvcmQgc2hlZHVsZXIgdGhyZWFkKSB0aGVuIGNhbiB3YWtlIHVwIG9uZSB0aHJlYWQg
YW5kIGdpdmUga2V5Ym9yZCB0byBpdC4NCj4gDQo+IFVubGVzcyB0aGUgdGhyZWFkIHRoYXQgbGlz
dGVucyB0byB0aGVzZSByZXF1ZXN0cyBpcyBuZXZlciBibG9ja2VkLCBJDQo+IGRvbid0IHNlZSBo
b3cgdGhpcyBjb3VsZCB3b3JrLg0KPiANCkl0IGxpc3RlbnMgdG8gdGhlc2UgcmVxdWVzdHMsIHNv
IGl0IHdpbGwgYmUgd2FrZWQgdXAgd2hlbiB0aGVyZSBpcyBhIG5ldyByZXF1ZXN0IGFycml2aW5n
LiBJdCB0aGVuIHJlYWRzIHRoZSByZXF1ZXN0IGFuZCBwdXQgaXQgaW50byBpbi1ib3guDQoNCldo
ZW4gdXNlciB3YW50IHRvIHByb2Nlc3MgYW4gaW5wdXQsIHRoZSBmb2xsb3dpbmcgZnVuY3Rpb24g
d2lsbCBiZSBjYWxsZWQ6DQoNCnZvaWQgUHJvY2Vzc19hbl9pbnB1dF9yZXF1ZXN0KGlucHV0X3Jl
cXVlc3QpDQp7DQoJLy8gMC4gZ2V0IHRoZSB0aHJlYWQgb2YgdGhlIHJlcXVlc3QNCgl0aHJlYWRf
aWQgPSBpbnB1dF9yZXF1ZXN0LT50aHJlYWRfaWQ7DQoJdGhlX3RocmVhZCA9IGdldF90aHJlYWQo
dGhyZWFkX2lkKTsNCg0KCS8vIDEuIHdha2UgdXAgdGhlIHRocmVhZCwgYW5kIGdpdmUga2V5Ym9h
cmQgdG8gaXQNCglSZWxlYXNlX2xvY2sodGhlX3RocmVhZC0+a2V5Ym9hcmRfdXNpbmdfbG9jayk7
DQoJLy8gMi4gd2FpdCBmb3IgdGhlIHRocmVhZCB0byBmaW5pc2gNCglBY3F1aXJlX2xvY2sodGhl
X3RocmVhZC0+a2V5Ym9hcmRfZmluaXNoZWRfbG9jayk7ICAvLyB3aWxsIGJlIGJsb2NrZWQgdW50
aWwgdGhlIHRocmVhZCBmaW5pc2hlcyB0aGUgaW5wdXQgdGFzaw0KDQoJLy8gMy4gcmVjbGFpbSB0
aGUga2V5Ym9hcmQNCglBY3F1aXJlX2xvY2sodGhlX3RocmVhZC0+a2V5Ym9hcmRfdXNpbmdfbG9j
ayk7DQoJUmVsZWFzZV9sb2NrKHRoZV90aHJlYWQtPmtleWJvYXJkX2ZpbmlzaGVkX2xvY2spOw0K
DQoJLy8gLi4uDQp9DQoNClRoZSBhYm92ZSBmdW5jdGlvbiB3aWxsIGJsb2NrcyB0aGUgbWFpbiB0
aHJlYWQob3Iga2V5Ym9hcmQgc2hlZHVsZXIgdGhyZWFkKSB1bnRpbCB0aGUgaW5wdXQgaXMgZmlu
aXNoZWQuIERvbqGvdCBrbm93biBpcyBpdCBPSyBmb3IgZW1hY3MgaW50ZXJuYWwuDQoNCg0KPiBB
bmQgaW4gYW55IGNhc2UsIHdoYXQgc2hvdWxkIGEgbm9uLW1haW4gdGhyZWFkIGRvIGlmIGl0IHdh
bnRzIHRvIGFzayBhDQo+IHF1ZXN0aW9uPyAgQXNraW5nIGEgcXVlc3Rpb24gaW52b2x2ZXMgZGlz
cGxheWluZyB0aGUgcXVlc3Rpb24gYmVmb3JlDQo+IHJlYWRpbmcgdGhlIGFuc3dlci4gIFlvdSBv
bmx5IHRhbGtlZCBhYm91dCB0aGUgc2Vjb25kIHBhcnQuDQoNCkl0IGNhbiBjYWxsIGEgZnVuY3Rp
b24gbGlrZSB0aGUgZm9sbG93aW5nOg0KDQppbnQgQXNrX2FfcXVlc3Rpb25fd3JhcHBlcihwcm9t
cHQpDQp7DQoJU2VuZF9pbnB1dF9yZXF1ZXN0X2V2ZW50KEdldF90aHJlYWRfaWQoKSwgcHJvbXB0
KTsNCg0KCS8vIDEuIHJlcXVlc3QgdGhlIGtleWJvYXJkDQoJQWNxdWlyZV9sb2NrKEN1cnJlbnRf
dGhyZWFkKCktPmtleWJvYXJkX2ZpbmlzaGVkX2xvY2spOw0KCUFjcXVpcmVfbG9jayhDdXJyZW50
X3RocmVhZCgpLT5rZXlib2FyZF91c2luZ19sb2NrKTsgLy8gd2lsbCBiZSBibG9ja2VkIHVudGls
IHRoZSBtYWluIHRocmVhZCB3YWtlIHVzIHVwLg0KDQoJLy8gMi4gZG8gdGhlIHJlYWwgaW5wdXQN
CglyZXN1bHQgPSBBc2tfYV9xdWVzdGlvbihwcm9tcHQpOw0KDQoJLy8gMy4gZ2l2ZSBiYWNrIHRo
ZSBrZXlib2FyZA0KCVJlbGVhc2VfbG9jayhDdXJyZW50X3RocmVhZCgpLT5rZXlib2FyZF91c2lu
Z19sb2NrKTsNCglSZWxlYXNlX2xvY2soQ3VycmVudF90aHJlYWQoKS0+a2V5Ym9hcmRfZmluaXNo
ZWRfbG9jayk7DQoNCglyZXR1cm4gcmVzdWx0Ow0KfQ0KDQpUaGUga2V5Ym9hcmRfdXNpbmdfbG9j
ayBzaG91ZCBiZSBhY3F1aXJlZCBieSB0aGUgbWFpbiB0aHJlYWQgaW5pdGlhbGx5Lg0KSXMgdGhl
cmUgYSBzaW1wbGUgd2F5IHRvIGxldCBhIHNwZWNpZmllZCB0aHJlYWQgcnVuIGFuZCB3YWl0IGZv
ciBpdCB0byBmaW5pc2ggYSB0YXNrPw0KTWF5YmUgdGhlIGNsaWVudC1zZXJ2ZXIgbW9kZWwgaXMg
c2ltcGxlciwgbGlrZSBUQ1Chr3MgdGhyZWUgd2F5IGhhbmRzaGFrZS4NCg0KDQoNCg0K





Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.