From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Gerd_M=C3=B6llmann?= Newsgroups: gmane.emacs.devel Subject: Re: igc, macOS avoiding signals Date: Mon, 30 Dec 2024 16:05:07 +0100 Message-ID: References: <799DDBC5-2C14-4476-B1E0-7BA2FE9E7901@toadstyle.org> <86ed1rswup.fsf@gnu.org> <87h66loc17.fsf@gmail.com> <878qrxoayj.fsf@gmail.com> <8734i5o6wc.fsf@gmail.com> <87cyh9mpn5.fsf@gmail.com> <86r05pnrv4.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22993"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: eller.helmut@gmail.com, spd@toadstyle.org, pipcet@protonmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 30 16:05:46 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 1tSHKz-0005sK-Uc for ged-emacs-devel@m.gmane-mx.org; Mon, 30 Dec 2024 16:05:45 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tSHKX-0002CW-OB; Mon, 30 Dec 2024 10:05:17 -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 1tSHKV-0002Bi-9M for emacs-devel@gnu.org; Mon, 30 Dec 2024 10:05:15 -0500 Original-Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tSHKS-0007Ct-NM; Mon, 30 Dec 2024 10:05:14 -0500 Original-Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5d3e9f60bf4so15784124a12.3; Mon, 30 Dec 2024 07:05:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735571109; x=1736175909; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OskMBW7vj5GusxraH9yE4S+PFKu80kMxBY1gVfEjxpQ=; b=RMQfJCPq2q7ELZ4DQ3FN8vkRu1IZFm0OKYMhgEvASkzJqchNnYLnmcckBIZ/xlBcJa kog3I7Y0kpdMUDPaqBdPaKMW25sIfaF5LrAphgFfKWSAkbexwdz5AWuvJOR5Am3UAQOZ FCqvzpMRHXCB+/BL0AO3wetchA9AmPJmTeSxt/TGRvb7LQT5mIrrPsfuQQwq14/isGRm Exfj9sVmJSAQUgTAXTolGfZxMaXcSblR9MHzSDDBuJmznZCqIAfFF2OnPgs1cRpYy0Az zsqkTPpZ5uV1J8VtjOCtCW4e9ST0Ol4RHqjX4QIFfkmV8l5Lq1WYJXCp6RHXCWwSjy68 5zWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735571109; x=1736175909; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=OskMBW7vj5GusxraH9yE4S+PFKu80kMxBY1gVfEjxpQ=; b=cPP2gd3NDjA3WXi6XPfyVe9fARkOhhXrLyUHhmOp8+TSRjMpMovCjLZH4rqw/MYdGR vluXr8AjKMo8CjzTHWaCDC+pVydOjGMl6m/WgEGsHuX8FG+pD4hWnTqpr7SgRXcpNTjE UL4S6kOvbC/g2zroQGzuB8oXQqJp/QHF2gayFa7tbNygiPFevEBNXzaVvIgaRn+p+bEA lNa05EW47GaT2DWjsuQCIXvtmhOQ1HwgELsqJUTB65dJCmvnx13ankU4PW1OgiLDHmRz YFV3sdZKgKrE2YZFLwgemC+QlKOOs03CAvHz0VBQfsMimClnSY49nvtFJ2UpIRHMiMxv Uteg== X-Forwarded-Encrypted: i=1; AJvYcCU/1Veb7A2dFhRZUChQYGtiRtUnB1XebDuhLpzo+EWogz1/F/LWn1ZcpEIGJ6kZmJQzbVJKnl23Go6UPg==@gnu.org X-Gm-Message-State: AOJu0YynMmGMBYW7vyVftRLeUGuHQ1FEomdFWXs5mkVkzSabE+rBOYOC MP83V3FmpCsEUlomNCqa4balfoti0Zy8+T0zSOUka3kU7ncynk5rV1hGLQ== X-Gm-Gg: ASbGncuyi+8J+5L7hs5JhvabofJLrwzBxECXNkFM0HiFiNjddszMOkdp8T9ilIt/c8S zQIGsoWr3DGh9aS0RB1nk6d0+aQz0v6DlkuX4rVa+uWZvRvxbt5CdBV9QZHb56hi+6Uv1AcVnIG yZRgNctoQCR+5OEiBwZyuAben7FVuznMzm2BkpSs5BDRigzB4vChnSur9F4nrma5jFmUQIHWWUS JRN3ZzO23j6SEojKpjM7s7SG8tdMXArOsiQAy4N3Asfl6k4n5Mko+tJ4BihaUQjl6byCPZB4QH0 vsX4FOTXTdf9KC476OJkXAeP37EQgqR+DWS6J4gLL1GWRWftcewhto0KBp6ieN7l X-Google-Smtp-Source: AGHT+IEep0nZKoAvcDEGOQkosYH+O/2TGndz+dUREIyiICgHpyxuPywSahs4gdKwLc8WKqblFhJlZw== X-Received: by 2002:a05:6402:430c:b0:5d8:253:b7df with SMTP id 4fb4d7f45d1cf-5d81de22d07mr30975471a12.27.1735571108702; Mon, 30 Dec 2024 07:05:08 -0800 (PST) Original-Received: from pro2 (p200300e0b7156f000dceccb84ca1ba38.dip0.t-ipconnect.de. [2003:e0:b715:6f00:dce:ccb8:4ca1:ba38]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aac0f06fb1bsm1467349866b.191.2024.12.30.07.05.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Dec 2024 07:05:08 -0800 (PST) In-Reply-To: <86r05pnrv4.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 30 Dec 2024 16:54:39 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=gerd.moellmann@gmail.com; helo=mail-ed1-x52b.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FREEMAIL_REPLY=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:327436 Archived-At: Eli Zaretskii writes: >> From: Gerd M=C3=B6llmann >> Cc: Eli Zaretskii , spd@toadstyle.org, >> pipcet@protonmail.com, emacs-devel@gnu.org >> Date: Mon, 30 Dec 2024 12:53:33 +0100 >>=20 >> Executive summary: If a signal interrupts the Emacs thread, and we are >> "inside MPS", meaning the Emacs threads owns an arena's mutex, the macOS >> port thread can try to acquire the same mutex and won't get because the >> Emacs thread that owns it is stopped by the signal. > > Are you sure the "because the Emacs thread that owns it is stopped by > the signal" part is correct?=20=20 It's not correct, sorry. When it lands in the port thread, the Emacs thread has been suspended by the OS. > AFAIU, since the macOS port thread is a different thread, it tries to > take the arena lock, and is simply stuck there, waiting for the main > thread to release the lock. IOW, this is a simple mutex-based > synchronization between two threads, that's all: one thread takes the > lock, the other must wait until the first one releases it before it > itself can take the lock. That's right. The port thread can't get the lock because it's owned by the Emacs thread. And the Emacs thread is suspended by the OS. > > Moreover, the main thread is not stopped, it runs the signal handler. > Right? The Emacs thread is suspended by the OS to let the port thread handle the situation. After the thread is suspended, the OS sends the port a message. The port thread is waiting for such a message with mach_msg. The port does its thing, and when it replies to the OS message accordingly, the OS lets the Emacs thread continue. But that reply is never sent because the port is stuck on the mutex. Hope that's more correct.