[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Make computational threads leave user interface usable
From: |
Paul Pogonyshev |
Subject: |
Re: Make computational threads leave user interface usable |
Date: |
Wed, 1 Nov 2017 22:19:39 +0100 |
> I wouldn't say it's pointless, just that it calls for a programming regimen
> where you add (thread-yield) calls at appropriate places.
What if this auto-yield is made optional? It sort of already is in the
patch, but the default value could be made nil. Then, you can activate
it downstream by using (let ((thread-auto-yield-after ...) ...), but
normally it is not active. So, activating becomes your own decision,
not something sneaked upon you.
Peppering code with (thread-yield) has downsides in that it requires
to write every single piece of code you might at some point run in a
separate thread with that in mind. And not everything is as simple
as one loop with many iterations. And if you fail to add (thread-yield)
at reasonable intervals, it will still lead to unresponsive UI that
sometimes works smoothly, yet at other times freezes for a couple
of seconds.
I think it would be very useful to be able to run sort-of-arbitrary
computation without freezing UI. (Sort-of, because it shouldn't
interfere with UI, but otherwise can compute whatever it wants).
Imagine e.g. running 5000 ERT tests, and still continuing to work
with Emacs as normal.
Paul