all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Elias Mårtenson" <lokedhs@gmail.com>
Cc: raeburn@raeburn.org, tino.calancha@gmail.com, 25247@debbugs.gnu.org
Subject: bug#25247: 26.0.50; Concurrency crashes with XLib
Date: Sat, 31 Dec 2016 17:51:21 +0200	[thread overview]
Message-ID: <83mvfcgkqu.fsf@gnu.org> (raw)
In-Reply-To: <CADtN0WJ-X9KqFmUaS1BVqunRw7urJnbWDJRzZ0Af70AZ_B7v-A@mail.gmail.com> (message from Elias Mårtenson on Sat, 31 Dec 2016 23:34:33 +0800)

> From: Elias Mårtenson <lokedhs@gmail.com>
> Date: Sat, 31 Dec 2016 23:34:33 +0800
> Cc: Tino Calancha <tino.calancha@gmail.com>, raeburn@raeburn.org, 25247@debbugs.gnu.org
> 
> I always turn off blink-cursor, but just to ensure that I was correct, I tried to reproduce with -Q and that was
> very revealing.
> 
> With -Q and only turning off blink-cursor-mode, I get no updates until I hit a key. With blink-cursor-mode on, it
> updates during the blinking phase just as you suggested it would.
> 
>  When blink-cursor-mode is ON, it supplies 2 events each second, and
>  that allows the threads that finished waiting to acquire the global
>  lock and insert the string. Otherwise, the threads wait for the
>  global lock and do the insertions at the end.
> 
> I can only conclude that one of my millions of customisations triggers a refresh at some interval that is rougly
> 4-5 seconds.

Look at timer-idle-list for possible illumination.  Failing that, look
at timer-list.

When timers are active, wait_reading_process_output (which is where
implicit thread switches are triggered) reduces the timeout values it
uses when it calls thread_select/pselect.  It does so in order not to
miss the time when the next timer is set to expire.  That makes the
Emacs main loop crank at higher frequency, and each cycle brings
another chance for another thread to start running, because
thread_select starts by releasing the global lock.

So what a frequent timer does is it allows threads that finished
waiting in sit-for to run the rest of their code, which is insert the
string into the buffer.

> I also discovered that the event is actually triggered (i.e. the call to sleep-for actually finishes on-time but it's
> just the buffer content that are not updated). That makes things a lot more clear for me.

Yes, because the thread which finished its sleep time goes on to
reacquire the global lock, and waits for that to be come available.

> Now, this begs the question: Is this the appropriate behaviour? It would be very nice if buffer updates made by
> threads were immediately updated on the screen. If that is not possible for some reason, I think there should
> be some way for Elisp code to force the repaint of a buffer.

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





  reply	other threads:[~2016-12-31 15:51 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-22 10:20 bug#25247: 26.0.50; Concurrency crashes Tino Calancha
2016-12-22 17:28 ` Eli Zaretskii
2016-12-23  3:34   ` Tino Calancha
2016-12-23  8:34     ` Eli Zaretskii
2016-12-23 11:32       ` Tino Calancha
2016-12-23 14:14         ` Eli Zaretskii
2016-12-29 11:37           ` bug#25247: 26.0.50; Concurrency crashes with XLib Tino Calancha
2016-12-29 17:44             ` Eli Zaretskii
2016-12-30  3:13               ` Tino Calancha
2016-12-30  7:19             ` Ken Raeburn
2016-12-30  8:37               ` Eli Zaretskii
2016-12-30  9:41                 ` Eli Zaretskii
2016-12-30 10:30                   ` Elias Mårtenson
2016-12-30 11:05                     ` Eli Zaretskii
2016-12-30 11:21                       ` Elias Mårtenson
2016-12-30 18:54                         ` Eli Zaretskii
2016-12-30 20:40                           ` Eli Zaretskii
2016-12-31 11:05                         ` Eli Zaretskii
2016-12-31 15:34                           ` Elias Mårtenson
2016-12-31 15:51                             ` Eli Zaretskii [this message]
2016-12-31 16:24                               ` Elias Mårtenson
2016-12-31 17:18                                 ` Eli Zaretskii
2016-12-31 17:28                                   ` Elias Mårtenson
2016-12-31 18:06                                     ` Eli Zaretskii
2016-12-31 18:16                                       ` Elias Mårtenson
2016-12-31 18:29                                         ` Eli Zaretskii
2016-12-31 18:38                                           ` Eli Zaretskii
2016-12-30 13:45                   ` Tino Calancha
2016-12-30 16:57                     ` Eli Zaretskii
2017-01-06  0:03                       ` npostavs
2017-01-06  7:48                         ` Eli Zaretskii
2016-12-23  9:34   ` bug#25247: 26.0.50; Concurrency crashes Ken Raeburn
2016-12-23 10:04     ` Eli Zaretskii

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

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

  git send-email \
    --in-reply-to=83mvfcgkqu.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=25247@debbugs.gnu.org \
    --cc=lokedhs@gmail.com \
    --cc=raeburn@raeburn.org \
    --cc=tino.calancha@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.