From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: Blocking calls and threads Date: Thu, 20 Apr 2023 21:28:01 +0800 Message-ID: <875y9qfztq.fsf@yahoo.com> References: <838ren6mpp.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="13219"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Lynn Winebarger Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Apr 20 15:28:56 2023 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 1ppULI-0003Iw-BO for ged-emacs-devel@m.gmane-mx.org; Thu, 20 Apr 2023 15:28:56 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUKf-00014F-2X; Thu, 20 Apr 2023 09:28:17 -0400 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 1ppUKc-00013f-K2 for emacs-devel@gnu.org; Thu, 20 Apr 2023 09:28:14 -0400 Original-Received: from sonic302-21.consmr.mail.ne1.yahoo.com ([66.163.186.147]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ppUKa-0001cD-RA for emacs-devel@gnu.org; Thu, 20 Apr 2023 09:28:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1681997290; bh=VG7LOlYQRSITMjFtM3TxNhBu7vgBEb+Jx/XKDdVLGSM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=LTSSNWq3BR4wTlSekdkeF0ddstuDp8VptbNIliU6Ypjt6MIvnHAfiD9P+gGhYRGIemAkwk+ugw6PD9GP07TNx87s1wHcwB40RUQpTnz9pQEQ+d1UcvARAjEMrnYSXmmpKrBa/BJoa6g3q0UMM4h1pRByr0u5uBfnR5GxnxFjE+t0yB9wJk0eQiPorFhoEYB/lRMa48E5ku4bK/bG7UaNm1Nk8SZOaXWk3ONB3N9FRGIu3AMmLiqndGcj6vod4JDft3Uunji6sNhDWuKD4EglWAy5xW9wT5sRr/LIdtG60NxGmfNFdlQV/nUq8WuAetbVCfvL9ilQ0y9Mlcqr3W/4mg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1681997290; bh=hqV4ZFo0p/jetLLDTNWKJ9XYYUNGs9R0XWOBbHCE6A9=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=eALZZAwWkCgP4salrZA96IveVJSsETGB7EMxOJsYPj/FafjX+QIRmAGw5AMy8k8fK7A2ktD2z27deMrUrDjt7ZuiPjlbcrUCLXEbfx4obVHHaYV2oMgjYCD9/egtzMMeJKI28NY2MKNiglRKZx/iC9NbpDeDNLf94LRfZnOCXO69OxxY+onf9/2DywOyrWlaB58qphxPmVKnJ8qL4bLVbmfVPtmcokFAaMqj8xmHg5JDJnQKNEwqRjlikmwCzrIuIzQ2IlwcmUukwyGEIgVBwX6SzkT6OgUxNRDzZ5+I82eAKapbm9puaQoFG1I9cjCKU41zMwIB4DGMIvHV4A/URw== X-YMail-OSG: DEbg4FAVM1l9JgUKnVoVi5fI9YYi7KljSZA6zpa5mIfrL_BEdxzrEELquwymK9a oragyCqET61N7wHsBwtsBFQPJyDmeDQcm2vRribfQlwJUHu5Jr.WsaeDiw8Rzbg0Qa8eIU8W8LWn By_FEMcimqBdM7dGKl1nz_oI_JkWz301tL1SEqXmiBmZo65NpFoP3aPaaMQ5DLu7_fKrDg_EKIc1 C_s9Uzxpg7DhjxAReo0ECGpA53U3A5DmM9U54Mtfn44QvN52CIss6FJhTjKLm8gaduMSFjyAUAdL .W11sZ1smo.xawljb0R_dn8qGD.gCHrkJtV_xOHMCAHYQl9Qc1l8e6OMJuO6xi5t80amef9FdPGL o_4AqTNDZXQ4Gi2OG9HLCLbojsQgRGam3NOaOOJJ3YbxIE1H6uXZ.wpRDH0.Lk5KZhS0KDWjePuJ nZ1TegtJhubQp.tgUQ8Rx0uEqS5Y2jOjCwxbvv6I.guEw1k_fbHkabHi2.1ztsUDr5F4UhDARxWP CZSMmaIuoJqM_CgFgYF33zuy1vDBjCJKDdincwJR7vCjNCUmKjRdH5BJM8Wel_r2EPfV76Nyl7Lc _5b6CdKyHFsftHRRlsZeU.RUWsX_OKoB6.1CJQdLemlhb3O10l8PphdPf6RNXiB_Oq9Ze1o9AHWk iSJt.ve9jFm5KZbij1K4QXN4_Qyg1d9Sfe_v.hkXsnjUGX9Gq9rvqSi2HHnqDLrOxdGk0SwDSRyV ZHnSawH8V5Etvll6d8eJigiGsjcZmoKF1J1llxalffHVzNvaaBE4KhRfHxSTS2nR1suVmyNEQXsq 1PHhxxWZ8zr7wjSLLBhYkV.fqP8aLsyg6Bo_qOUU.8 X-Sonic-MF: X-Sonic-ID: f77d6920-96cc-4464-bf45-64d81455be3b Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.ne1.yahoo.com with HTTP; Thu, 20 Apr 2023 13:28:10 +0000 Original-Received: by hermes--production-sg3-6d6fb994f6-gm72r (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 482d39ea83d445824aede6aa8d3f41fd; Thu, 20 Apr 2023 13:28:06 +0000 (UTC) In-Reply-To: (Lynn Winebarger's message of "Thu, 20 Apr 2023 09:06:16 -0400") X-Mailer: WebService/1.1.21365 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.186.147; envelope-from=luangruo@yahoo.com; helo=sonic302-21.consmr.mail.ne1.yahoo.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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:305505 Archived-At: Lynn Winebarger writes: > Presumably whatever mechanism is used for the calls you identified > below could be generalized. In practical terms, it would mean > assigning locks to every system resource that isn't inherently part of > the lisp machine, in this case at least file descriptors. Then, for > example, the read call in emacs_intr_read (in sysdep.c) could be > surrounded by a release of the global lock (which yields the thread of > the lisp machine) and the re-acquisition of the global lock. The file > descriptor lock might be acquired after yielding the lisp thread, or > it might be owned exclusively by the thread that opened it. I'm afraid that's not so easy. Parts of Emacs have certainly been designed with the assumption that context switching cannot happen inside read and friends; at least the Android and NS ports have this problem. > Are these identified as a group anywhere for reference? Otherwise, I > don't know what is included in the "etc". Basically anything that calls `thread_select'. This includes almost everything that waits for input. Please grep around in the C sources.