From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.devel Subject: Re: Releasing the thread global_lock from the module API Date: Fri, 01 Mar 2024 14:02:24 -0500 Message-ID: References: <86cysdrja3.fsf@gnu.org> <86a5nhrdv0.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35500"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Mar 01 20:23:11 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 1rg8TP-0008wo-Dd for ged-emacs-devel@m.gmane-mx.org; Fri, 01 Mar 2024 20:23:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rg8Sh-0003iO-2A; Fri, 01 Mar 2024 14:22:27 -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 1rg89K-0002hj-Vy for emacs-devel@gnu.org; Fri, 01 Mar 2024 14:02:27 -0500 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rg89J-0004v0-GA for emacs-devel@gnu.org; Fri, 01 Mar 2024 14:02:26 -0500 In-Reply-To: <86a5nhrdv0.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 01 Mar 2024 20:44:35 +0200") DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1709319744; bh=0FL29N2nKHSJ/MKzq8my5hbxB7VwP4z9T0QoQbB4L9I=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=zZH2WUjK69HIoO0DBJlbH5SLaTIjBpkQbIdQHZX160Fy5jmnT+MQmDoeIecD7bQzA RaIBIVTYPjbIpqFulSddWTHcC9iVy8rd2L++9ZodhWk8qRiTC0MyROBeIH44hprURB X+heEsNwNfQNPxl2VUPGM1Rx+FML9DsXqO15T9X9djohFTZOGUe0lZazxNBp/XFE7K HfZZIuat5T8m4tv7BabO/Er0c3pPxa7LcxEtgxeMEtqxcNKf3fE3IBpeKg4cL7ufam SqLP1KVJPmX4IwMQrAPs5p6fGSXe0eewXXtAlx38ps1S0ZymbNq1UOl1vIi4BVrlK1 dgNBY8xheUzkA== Received-SPF: pass client-ip=64.215.233.18; envelope-from=sbaugh@janestreet.com; helo=mxout5.mail.janestreet.com 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, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 01 Mar 2024 14:22:23 -0500 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:316675 Archived-At: Eli Zaretskii writes: >> > I think this is already possible, see above. I guess I'm missing >> > something. >> >> I don't think it is. How would a module release global_lock, call a C >> library function on the current thread, and then re-acquire the global >> lock? Can you say how you would do that with the APIs we have today? > > If a thread releases a global lock, it cannot run the Lisp machine > until it re-acquire the global lock. Yes. But calling a C library function (by some other library not related to Emacs but used by the module) does not involve calling into the Lisp machine or any Emacs machinery. So, because it does not involve calling into Emacs, we could allow the thread to make that call without the Emacs global lock which protects Emacs.