From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "John Wiegley" Newsgroups: gmane.emacs.devel Subject: Re: Make computational threads leave user interface usable Date: Wed, 01 Nov 2017 14:47:41 -0700 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1509572906 29683 195.159.176.226 (1 Nov 2017 21:48:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 1 Nov 2017 21:48:26 +0000 (UTC) User-Agent: Gnus/5.130016 (Ma Gnus v0.16) Emacs/26.0 (darwin) Cc: Emacs developers To: Paul Pogonyshev Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 01 22:48:21 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 1eA0s0-00079F-5w for ged-emacs-devel@m.gmane.org; Wed, 01 Nov 2017 22:48:20 +0100 Original-Received: from localhost ([::1]:57817 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eA0s7-00037g-93 for ged-emacs-devel@m.gmane.org; Wed, 01 Nov 2017 17:48:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55792) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eA0rX-00037E-ID for emacs-devel@gnu.org; Wed, 01 Nov 2017 17:47:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eA0rW-000738-Ne for emacs-devel@gnu.org; Wed, 01 Nov 2017 17:47:51 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:41126) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eA0rS-00070I-Jh; Wed, 01 Nov 2017 17:47:46 -0400 Original-Received: from auth2-smtp.messagingengine.com ([66.111.4.228]:45477) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1eA0rS-00030Z-Bq; Wed, 01 Nov 2017 17:47:46 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailauth.nyi.internal (Postfix) with ESMTP id 8BF5020985; Wed, 1 Nov 2017 17:47:45 -0400 (EDT) Original-Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Wed, 01 Nov 2017 17:47:45 -0400 X-ME-Sender: Original-Received: from Vulcan.local (76-234-69-149.lightspeed.frokca.sbcglobal.net [76.234.69.149]) by mail.messagingengine.com (Postfix) with ESMTPA id 4DC5C2486F; Wed, 1 Nov 2017 17:47:45 -0400 (EDT) Original-Received: by Vulcan.local (Postfix, from userid 501) id 32763A77DBED; Wed, 1 Nov 2017 14:47:44 -0700 (PDT) In-Reply-To: (Paul Pogonyshev's message of "Wed, 1 Nov 2017 22:19:39 +0100") Mail-Followup-To: Paul Pogonyshev , Emacs developers X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e 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:219861 Archived-At: >>>>> "PP" == Paul Pogonyshev writes: PP> What if this auto-yield is made optional? It sort of already is in the PP> patch, but the default value could be made nil. Then, you can activate it PP> downstream by using (let ((thread-auto-yield-after ...) ...), but normally PP> it is not active. So, activating becomes your own decision, not something PP> sneaked upon you. Here's what I would accept: A macro to inject (thread-yield) calls into function definitions. This is extremely low-impact (just a new macro), works with the existing implementation, and offers the semantics you're asking for in a way that's good enough for now. Of course, it only works for code defined using the macro, but I actually don't _want_ a patch that changes code written to be cooperative into code that evaluates pre-emptively. If, on the other hand, you want to define a set of thread functions that allow full pre-emption by auto-injecting yield points, then I believe such a macro would serve this need. -- John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2