From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Is automatic yield support feasible for threads? Date: Wed, 10 Nov 2021 15:46:02 +0200 Message-ID: <8335o43yzp.fsf@gnu.org> References: <46501A5F-9C72-4048-8EEA-CE219D54CEC2@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9598"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 10 14:48:49 2021 Return-path: Envelope-to: geh-help-gnu-emacs@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 1mkny5-0002M1-Lg for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 10 Nov 2021 14:48:49 +0100 Original-Received: from localhost ([::1]:35830 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mkny4-000332-Je for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 10 Nov 2021 08:48:48 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:36586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mknvU-00007F-DK for help-gnu-emacs@gnu.org; Wed, 10 Nov 2021 08:46:08 -0500 Original-Received: from [2001:470:142:3::e] (port=58942 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mknvU-0004rs-3F for help-gnu-emacs@gnu.org; Wed, 10 Nov 2021 08:46:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=KcIhSlVb4L9ndf+5yVO6d7bFuwzTuQ+vcDYCDy85q50=; b=mJ69u5oek6nu Ql3HOfouGeVHcRfP0FpxS9pZglKE9YBqr2Gw7l0U4pjfiud/2sGt1O80od5ZZMI7q5d3au/Q0jAn3 y0ionzK36sc0zGc5kfxH/FjTvRouHcjYZ1HCW9ee9qGo/QkgyUi8KLg6pgF9og4KqBWTsDsQIpzBG Px3MPQPHD7TJFk4U6vQ1OQi01Y9BNkkEH2xaeFylNlkLXwVBmuUWPaqZP7T9zvE1zFvLR7OzcMJkh 1c9ZSmCCUWvDq7lqUNigV2o4SvVOyDJTiu+zaoHMlw29FeuUsKN6U4649fdglss8dt3lcuA8j979E ar61kBng0amtsfMxqPp58g==; Original-Received: from [87.69.77.57] (port=4129 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mknvT-0002nm-5a for help-gnu-emacs@gnu.org; Wed, 10 Nov 2021 08:46:07 -0500 In-Reply-To: (message from ndame on Wed, 10 Nov 2021 07:46:48 +0000) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:134471 Archived-At: > Date: Wed, 10 Nov 2021 07:46:48 +0000 > From: ndame > Cc: "help-gnu-emacs@gnu.org" > > But you are right if someone uses a thread for UI changes then there can be problems. My idea is about an _optional_ automatic yielding for threads, so it still could be useful for those threads which are self contained. Those could choose to start with periodic automatic yielding, so their code do not have to be sprinkled with manual yield calls, impacting code readability. How can a thread be made to yield at some arbitrary point of its code without risking problems? E.g., a thread could be in the middle of some operation that must be done atomically.