From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: tomas@tuxteam.de Newsgroups: gmane.emacs.devel Subject: Re: Releasing the thread global_lock from the module API Date: Sat, 2 Mar 2024 17:31:55 +0100 Message-ID: References: <86cysdrja3.fsf@gnu.org> <470c6bea-805d-42dd-8bbd-936ea93c6579@gutov.dev> <19d51eaa-0f98-4542-9d08-0e9d23224dc4@gutov.dev> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="wfCgdsMXSbcE4nyc" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22907"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Spencer Baugh , emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Mar 02 17:32:57 2024 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 1rgSIC-0005ZS-HJ for ged-emacs-devel@m.gmane-mx.org; Sat, 02 Mar 2024 17:32:56 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rgSHO-0000f3-9o; Sat, 02 Mar 2024 11:32:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rgSHM-0000eS-AL for emacs-devel@gnu.org; Sat, 02 Mar 2024 11:32:04 -0500 Original-Received: from mail.tuxteam.de ([5.199.139.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rgSHI-00064H-OB for emacs-devel@gnu.org; Sat, 02 Mar 2024 11:32:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject :Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=8LfnoysPA0cI2XmA+Q1nq7Id5ZYPik48xlKBFQsq5ks=; b=CSjEN5Za2JeOm1tiCQ/l/QnK9K IA/JNaUTHdp7iQlM6lmhlg/hlDGVDOKklLf0kLIAWntNEKmiF1ZDmyum3BE+Sf1ozXU5a7wUsFsk6 IGShid6n6ulogPLP1vPSI59mgSQkaiZyIrwC5cI6U38ofZ8sLGL276YCJSv9OpEgIex4zKvc5vmoi GNQ2KMtA38UnvEjfAf6xLbMz7cXxT0iQarVj+liaV3KRXWH1hlHDcfzjBApVqG3FIW1KQFjCF2A3Z YHezuUZFOcB/AnRgW2bGFTkfnUPbiPwMWArcd66vAjnPJyh88kZxmbWiB0t+vtmV6sYp5Pwz9KqCd Rw4u3x3w==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.94.2) (envelope-from ) id 1rgSHD-0007yD-J0; Sat, 02 Mar 2024 17:31:55 +0100 Content-Disposition: inline In-Reply-To: <19d51eaa-0f98-4542-9d08-0e9d23224dc4@gutov.dev> Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:316701 Archived-At: --wfCgdsMXSbcE4nyc Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Mar 02, 2024 at 05:35:26PM +0200, Dmitry Gutov wrote: > On 02/03/2024 07:57, tomas@tuxteam.de wrote: > > On Sat, Mar 02, 2024 at 01:53:05AM +0200, Dmitry Gutov wrote: > > > On 01/03/2024 21:30, tomas@tuxteam.de wrote: > > > > > - Unrelated Lisp thread B is able to take the global lock and run= Lisp code > > > > > in parallel with module_work on thread A. > > > > > - On thread A, module_work finishes and returns to Lisp. > > > > Why has thread A wait up to here? This is what's keeping your threa= d B > > > > from playing, no? > > >=20 > > > I imagine thread A will want to continue its execution when the resul= ts of > > > the "Emacs-independent work" arrive. > >=20 > > In that case, I think your only choice would be to "pass the continuati= on": > > in A, stash away whatever you need to continue, let A die, and when thi= ngs > > "come back", start a thread A' to pick up where A left. >=20 > Almost, except "suspend/yield" instead of "let A die". This only if you can let Lisp suspend/yield safely -- i.e. in a way nothing bad happens if someone else gets a turn at playing the "interpreter" [1]. I don't think this is currently possible. Cheers [1] Well, with a compiler and that, you'd call it a "runtime", but the intention should be clear. Cheers --=20 t --wfCgdsMXSbcE4nyc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCZeNUdAAKCRAFyCz1etHa Rs6oAJwJvMXTnNbvdMeZbu/vraRCayHKdwCeJtTfk2Xx1DbrutOQijmlsh9QBXI= =P9JR -----END PGP SIGNATURE----- --wfCgdsMXSbcE4nyc--