From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Elias_M=C3=A5rtenson?= Newsgroups: gmane.emacs.devel Subject: Re: The event handling thread Date: Thu, 22 Dec 2016 11:12:08 +0800 Message-ID: References: <8360mj99oe.fsf@gnu.org> <83fulk610j.fsf@gnu.org> <83wpeu37nq.fsf@gnu.org> <831sx12n7f.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e0122ae9a85078f054436a285 X-Trace: blaine.gmane.org 1482376345 14246 195.159.176.226 (22 Dec 2016 03:12:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 22 Dec 2016 03:12:25 +0000 (UTC) Cc: emacs-devel To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 22 04:12:21 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cJtnl-0002aB-Hf for ged-emacs-devel@m.gmane.org; Thu, 22 Dec 2016 04:12:17 +0100 Original-Received: from localhost ([::1]:60168 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cJtnm-0004vB-PZ for ged-emacs-devel@m.gmane.org; Wed, 21 Dec 2016 22:12:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47629) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cJtng-0004q9-VC for emacs-devel@gnu.org; Wed, 21 Dec 2016 22:12:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cJtng-0007xB-4H for emacs-devel@gnu.org; Wed, 21 Dec 2016 22:12:12 -0500 Original-Received: from mail-wj0-x236.google.com ([2a00:1450:400c:c01::236]:36139) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cJtne-0007wl-DW; Wed, 21 Dec 2016 22:12:10 -0500 Original-Received: by mail-wj0-x236.google.com with SMTP id c11so12245779wjx.3; Wed, 21 Dec 2016 19:12:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=4I20koIs9I8JYoU1VzwhLf7MpN5dznDAxNS3v4Qs5ow=; b=FJoBV2s3aGBUpoe5vMdwnvkKSwliZjBlSP6k0nkfTGwqTNT8Jh9nB7abfPbDYRAfeY +JcTtXxA2HSZrj3GnZjme0PNScFIbmvR5Nktav792cSBYmYehdkmmpxsVkH+mwJjSg3G gfTF4mndjBKhK7MdW5eEyZTrSJ0t0Xkg1zRyAhvlf5XxnwNk4FFc0M+iMnm1M2vxNH3v ntLhYKUH5kOvCtFlxOx4rw69Ps4J625tigA4W8GADuDXvLDgS3HFcgvkpZeY3dmt+uQu wXsL5l0wfpLHSJnrho9Wi+NUbJk7NtMK88NBVpXAFXDKaIaueZMO6vpfxg1bmepEqhzy DDCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=4I20koIs9I8JYoU1VzwhLf7MpN5dznDAxNS3v4Qs5ow=; b=CcT1jSlXUsPUdzJrtxbAbpeeuVzyrbrENHybhskVfLFw+L1APKToCRRoXvj1HnDUds ZD+IV3ZMy0GSyHsXHmIqDiz+9/zwPOrrIz+5tRJ4eclzJV7Cfaab4dVSdr5OqTF3O66M hvwD6XUHmPe/jj1mFqLdh2qB01n6Dne1N/io7f92Z/5vnQQ5EiBiw8b6LPs5LmDHtXKX CD0RCzljxip1hrQCqf4gSso1OjMkqvSJLwreh8oXRW8NWJ0OjvwIFx6VvEpedP22ioF9 ZH7bbYOHke/+LlZuVDwwIdPjQz4DqzbrzEVUsGfqXxFgOiZj+ipLt/c7L56Otj2cnULZ 1Q/Q== X-Gm-Message-State: AIkVDXLRDypRTCqcWfrEBAcogU/5mZPzqH1mc9vixVYxitwHZ8w4cDY5VDm9L/3sh2PCB70nMqo4iterJc+vfg== X-Received: by 10.194.141.98 with SMTP id rn2mr7014344wjb.1.1482376329101; Wed, 21 Dec 2016 19:12:09 -0800 (PST) Original-Received: by 10.80.135.165 with HTTP; Wed, 21 Dec 2016 19:12:08 -0800 (PST) In-Reply-To: <831sx12n7f.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c01::236 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:210722 Archived-At: --089e0122ae9a85078f054436a285 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 22 December 2016 at 01:42, Eli Zaretskii wrote: > But that doesn't change the fact that it makes more sense to never allow > keyboard input to be processed by > > anything other than the main thread? > > Why does it make more sense than, say, serialize access to the > minibuffer such that only one thread can access it at a time? > It would, if the minibuffer was the only place where the keyboard was read. However, isn't this problem wider than just the minibuffer? In my tests with =E2=80=98sit-for=E2=80=99 and threads, I noticed that if m= ultiple threads do =E2=80=98sit-for=E2=80=99 at the same time, and a press a key, then only= one of the threads gets released. As you keep generating input, more and more of the threads exit the call to =E2=80=98sit-for=E2=80=99. A central input process= ing thread would fix this issue too, right? > > C-g isn't "normal" keyboard input, is it? > > It depends. It's a bit of both, at least on GUI frames. > Is this related to the messy event loop in GTK Emacs that people were commenting on in some other thread recently? --089e0122ae9a85078f054436a285 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On 2= 2 December 2016 at 01:42, Eli Zaretskii <eliz@gnu.org> wrote:

> But that doesn't change the fact that it makes more sense to= never allow keyboard input to be processed by
> anything other than the main thread?

Why does it make more sense than, say, serialize access to the
minibuffer such that only one thread can access it at a time?

It would, if the minibuffer was the only place where= the keyboard was read. However, isn't this problem wider than just the= minibuffer?

In my tests with =E2=80=98sit-for=E2= =80=99 and threads, I noticed that if multiple threads do =E2=80=98sit-for= =E2=80=99 at the same time, and a press a key, then only one of the threads= gets released. As you keep generating input, more and more of the threads = exit the call to =E2=80=98sit-for=E2=80=99. A central input processing thre= ad would fix this issue too, right?
=C2=A0
> C-g isn't "normal" keyboa= rd input, is it?

It depends.=C2=A0 It's a bit of both, at least on GUI frames.

Is this related to = the messy event loop in GTK Emacs that people were commenting on in some ot= her thread recently?
--089e0122ae9a85078f054436a285--