From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Alexander Miller Newsgroups: gmane.emacs.devel Subject: Re: Questions about throw-on-input Date: Mon, 11 May 2020 19:39:22 +0200 Message-ID: <72ec0924-42f3-9f55-7edb-b2f9b678f707@web.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="63868"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 Cc: eliz@gnu.org, yyoncho@gmail.com, emacs-devel@gnu.org To: monnier@iro.umontreal.ca Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon May 11 20:27:24 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jYD9A-000GNh-0N for ged-emacs-devel@m.gmane-mx.org; Mon, 11 May 2020 20:27:24 +0200 Original-Received: from localhost ([::1]:50302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYD98-0000sM-Rg for ged-emacs-devel@m.gmane-mx.org; Mon, 11 May 2020 14:27:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYCOX-0004NZ-T9 for emacs-devel@gnu.org; Mon, 11 May 2020 13:39:13 -0400 Original-Received: from mout.web.de ([212.227.15.14]:49637) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYCOW-0004Ho-M2; Mon, 11 May 2020 13:39:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1589218746; bh=rFmv8YaXh/k4ckkDe+V3nJ6yUtYepMyfdgS+Z/anhdQ=; h=X-UI-Sender-Class:To:Cc:Subject:In-Reply-To:From:Date; b=YtfAJcqpQvuuFZqFu7UpcIP0Wd3aLmelK7blaq5OBNRpYwjrQsw19CZ+FGjoc1eas 88+2bAQKwiuIHKpKcEF3yuW95VRkebJgcRQmwwaw6AYJBjLM6lExaoDfU+NwDMkrf3 uE+kaqYfTfdH8PuHuQgyPgF3kP4MBZY+6uneJYAU= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Original-Received: from [192.168.2.107] ([217.240.190.124]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MgzaT-1it5k730e5-00hQnr; Mon, 11 May 2020 19:39:06 +0200 In-Reply-To: Content-Language: en-US X-Provags-ID: V03:K1:NYXVP6CvisraH7R844xn+4jdSwOjlZ5OA3XwnpFGy5HSdEhVRpm tuMa+YGnWWURnni1m8xvZOYx3x+wHBH1yMNTNI4IXH0My908r/nCslcWLpPzvVVDoqRMGmO boDPd/XzDZAgR2bvHq0HRjGUCUyq8a9Bilgcr0U8AmbOR4WQNRGYFmtzITXcieMtGtfCGnm U+YNkk5mLjEXXhFiu+vBw== X-UI-Out-Filterresults: notjunk:1;V03:K0:u/l0kliV5F0=:n4EmV6cl2DJ72dZDMDp7fw Qbs6jmgcpCU+V+2W3j4LxR+Q0uOPdt63BxQbRkykl8X13/dG/IvfLVGCpFau6H5AipGSifMta aJMqGM+9knQbdlhErSeXNyguOax5w4NM8mFXYPtGfW18eyHR2eO0Ibe9310T9WgKixxvUG54g 3sDXlq2IbyCqc2slxTXNN+U/gxT4ujA9YuoRwdpp1aMl2uPl2E47TLUjLCCiTbVbWkvipFWje bKOvOUtR2gOMbvOxGrSUV5iU0eRn+S6imPFZsYchym0WxJn57hD+TXPwCMexNTQFOU2EqGAm9 DgaqFUQWTWSw4g0K27gbh8Q+WY8eZ2RL7Mh8RafwYsDZ0nhQYS4cdPOUOoCAgX+Y5LSM/B75z xamkTNv+WexNEJ8Xh9KUINZUWlLFizMaTZSuN4llwEhtfM7kq3ai8vnlrYdwPpvbEAxHp8wxB b3BAZjM2QBLLw+XWvSj1av77ou65mCNmctvdpFAXvNV6CKEhTGp+gKaXAB6Vmt2IrCgrg/KW/ ph10dsAgyDrTrFsE0868xDSBEhhFPJ2CFo0EBdD+o8z/BGpy8dNhf0Vn8+h2o0gTsaFZpvSaB mcarg8PECEV3B0iwvu5hqHIZT835yf4lgWLZ+cwWAFAxQu8HzA70rHGt3e/KWX9BaArcPUqPy vWDmHyKsrXdQ4uddQycaEf2DfIKZEaPf+c1X9RAgLAH0UUYkBFzebHA6YoWpj3r7r18280nXe L1YJt53Tc473z4vkK342mNdYbWAEk96KiCkGRvQjI0RSFvHxbOjMFlHONBMGZ+QmKIzJTTge Received-SPF: pass client-ip=212.227.15.14; envelope-from=alexanderm@web.de; helo=mout.web.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/11 13:39:09 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Mailman-Approved-At: Mon, 11 May 2020 14:23:39 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:249856 Archived-At: >> Do we want that? > > I don't know. But hanging because `select` doesn't return the needed > information doesn't seem right either. Maybe rather than signal an > error, we should somehow make the main thread run that code, so as to > return the right answer? That could be a game-changer, it would open up the path for making Elisp a lot more asynchronous than it is now. You could load up heavy work on a background thread, and (of course assuming it can be slit into smaller pieces) simply yield whenever input is detected. And when the main thread has done its part the worker would simply pick up again where it left off. That is something of a holy grail for many package developers like me - to be able to *do things*, especially in the background, without constant worry of freezing the UI. I don't think this is possible right now, other than maybe with awkwardly pushing around timers and while-no-input, or using mandatory 1ms pauses instead of proper yielding as in my benchmark, which is probably not exactly ideal either. And while we are on the topic of threads, I wonder what is the maintainers' opinion on https://nullprogram.com/blog/2018/05/31/, specifically this part: > Update: ThreadSanitizer (TSan) quickly shows that Emacs=E2=80=99 thread= ing > implementation has many data races, making it completely > untrustworthy. Until this is fixed, nobody should use Emacs threads > for any purpose, and threads should disabled at compile time.