From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Pogonyshev Newsgroups: gmane.emacs.devel Subject: Re: Make computational threads leave user interface usable Date: Wed, 1 Nov 2017 22:19:39 +0100 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1509571225 26071 195.159.176.226 (1 Nov 2017 21:20:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 1 Nov 2017 21:20:25 +0000 (UTC) To: Paul Pogonyshev , Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 01 22:20:16 2017 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 1eA0Qp-00065A-No for ged-emacs-devel@m.gmane.org; Wed, 01 Nov 2017 22:20:15 +0100 Original-Received: from localhost ([::1]:57754 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eA0Qw-0006s6-UK for ged-emacs-devel@m.gmane.org; Wed, 01 Nov 2017 17:20:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eA0QI-0006s1-Oe for emacs-devel@gnu.org; Wed, 01 Nov 2017 17:19:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eA0QH-0002Wo-Rj for emacs-devel@gnu.org; Wed, 01 Nov 2017 17:19:42 -0400 Original-Received: from mail-pf0-x235.google.com ([2607:f8b0:400e:c00::235]:53478) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eA0QH-0002WS-KV for emacs-devel@gnu.org; Wed, 01 Nov 2017 17:19:41 -0400 Original-Received: by mail-pf0-x235.google.com with SMTP id t188so2892903pfd.10 for ; Wed, 01 Nov 2017 14:19:41 -0700 (PDT) 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; bh=6tpf+XvyDJLj1hZbjg/nNmemgKG30lxV2vqpwrRYEOM=; b=uht17UQa84VFzrKedQNLX9IF/GsoTxhdOim0yEG1iyDJ3TadW/ENSAJHAN6m2njHHQ wa73x5YBl2JVyT2V23eT8iwH+e0VnxaQ/XFv1Md5iwz3YSDdocTXpmcfZc/B1wuJFNnX QljEs3EBujwp6WpU7lYUYR/WWohTwEdRMStFveJ2pYaNzKehT7CDq6Gzw/LymANf2YC7 06zjBMGhXLryDaqfiHNNAqcOhyy3Q7dwwvsPZm0bykEVFfRMfvJ54DzoybGkcFvJhBkU eARjS6V5X/zOm5lT/YCGjsW7sTdTTWs6rvKQ+aQbD0UyCrbV8xq/cIrPeyrGZCXHO/x8 sL0w== 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; bh=6tpf+XvyDJLj1hZbjg/nNmemgKG30lxV2vqpwrRYEOM=; b=R1Ok5px94KOg9gP0vX2uD4FTC/Otj0ZsvL5NRRmWEa6+yPH9OdVHPe9FYBZ3MSG/AQ GYVMG9LVzNogs0simAXbZWCPRsFRTfrhq2fdRhenR8S6Io/qAG9ON7y8qUmfx/8qswKQ VhHWj9npTEaXf1XuVE/+LQRYcELgzMj7c2xlbZkpje1V0zWrDJHXCachTyohcSi/RXeg SgMCefG8wzjMXL+fBAeeeKa6LidTYHzRUCQSHNwEUFO79K34sNswtQjSUqFeOkz4rUHt zmtryxIVlq+h51DqRqERamS/GJ6p7hTshI6GOo5e8bWAwo+MnE6vKqjGAWw5W+R/0SoN m6bw== X-Gm-Message-State: AMCzsaUuKNi6LLpXbGrtYQL6JDxg1sI6LVVakSWNykB+vI3hW5SfsTQn lzSkD621K1V7M4g4Ls3utJ7P6Gcg6+Y0Inqr9Q== X-Google-Smtp-Source: ABhQp+Tk9DixGIrHTk35a2CBi1UouwY+mT/+wB/4Ok2+WEa4T5M4UnJgsdkXuyB4zJYt5/ZAcwBUSH9uwmKKFwxn/qA= X-Received: by 10.84.131.6 with SMTP id 6mr894705pld.100.1509571180523; Wed, 01 Nov 2017 14:19:40 -0700 (PDT) Original-Received: by 10.100.162.238 with HTTP; Wed, 1 Nov 2017 14:19:39 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::235 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:219859 Archived-At: > 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