unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Platon Pronko <platon7pronko@gmail.com>
Cc: 34821@debbugs.gnu.org
Subject: bug#34821: discard_input_tty does not discard pending input, resulting in garbage inserted into the buffer
Date: Sun, 07 Apr 2019 21:24:58 +0300	[thread overview]
Message-ID: <83r2ad8yh1.fsf@gnu.org> (raw)
In-Reply-To: <492c723c-6ba9-24da-108f-b25cef0dd54e@gmail.com> (message from Platon Pronko on Sun, 7 Apr 2019 20:14:21 +0300)

> From: Platon Pronko <platon7pronko@gmail.com>
> Date: Sun, 7 Apr 2019 20:14:21 +0300
> 
> I guess that something in (terminal-init-xterm) hooks results in some buffer switch event being fired, that triggers the second return from read_char(). But since (terminal-init-xterm) and read_key_sequence() run concurrently, we have a race condition - if the terminal responds quickly enough, second buffer switch does not trigger quick enough and this problem happens.

What do you mean by "run concurrently"?  Emacs is pretty much a single
threaded program, and there's only one Lisp thread running at any
given time, which will execute both calls.

> Maybe trying to rely on terminal being slow with the response is not the best solution? Even if I find a cause of the buffer switch event, we won't have a way to ensure that it always arrives before the response to SDA query (because multithreading).

You may be right, but my reasoning was that without knowing why
there's a second buffer-switch event sometimes, we will be unable to
devise a good solution.  IOW, I think we need to understand the issue
better before we are ready to discuss a solution.





  reply	other threads:[~2019-04-07 18:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-12  7:53 bug#34821: discard_input_tty does not discard pending input, resulting in garbage inserted into the buffer Platon Pronko
2019-03-13  8:04 ` Platon Pronko
2019-04-07 16:06 ` Platon Pronko
2019-04-07 16:37   ` Eli Zaretskii
2019-04-07 17:14     ` Platon Pronko
2019-04-07 18:24       ` Eli Zaretskii [this message]
2019-04-07 19:06         ` Platon Pronko
2019-04-07 19:25           ` Eli Zaretskii
2020-05-24  6:23             ` Platon Pronko
2020-05-24  7:08               ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83r2ad8yh1.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=34821@debbugs.gnu.org \
    --cc=platon7pronko@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).