bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#25247: 26.0.50; Concurrency crashes with XLib


From: Elias Mårtenson
Subject: bug#25247: 26.0.50; Concurrency crashes with XLib
Date: Sun, 1 Jan 2017 00:24:59 +0800

On 31 December 2016 at 23:51, Eli Zaretskii <eliz@gnu.org> wrote:

I think the update on screen is indeed immediate, it's just that
insertion doesn't happen immediately after the sleep period ended.

I don't think it is. I ran the following test to check the behaviour:

Start 'emacs -Q'

Split into two windows, one with the file ~/foo.txt (empty) and the other with IELM

In the IELM buffer type:

 (setq lexical-binding t)
 (blink-cursor-mode -1)
 (dotimes (i 10)
(let ((j i))
  (make-thread (lambda ()
 (with-current-buffer "foo.txt"
   (sleep-for j)
   (insert (format "Foo:%d\n" j))
   (write-file "~/foo.txt"))))))

After doing this, I will see "Foo:0" displayed in the "foo.txt" buffer, and the message "Wrote /home/elias/foo.txt" updated every second in the minibuffer.

While this is running (and note that the buffer content has not been updated and still contains just the "Foo:0" message), I switch to a terminal and cat the content of foo.txt. I can see that the file gets updated and saved every second, but the content of the buffer is only refreshed when I interact with Emacs (i.e. pressing a key).

This suggests to me that everything is actually running exactly the way one would expect from a green threads implementation, where a thread doing a sleep becomes runnable immediatenly after the timer runs out (as long as the system is otherwise idle at the time).

It seems as it's simply the buffer content that isn't refreshed properly. Interestingly enough, the minibuffer message does get updated.

Regards,
Elias

reply via email to

[Prev in Thread] Current Thread [Next in Thread]