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 18:41:41 +0100 Message-ID: References: <799DDBC5-2C14-4476-B1E0-7BA2FE9E7901@toadstyle.org> <87h66loc17.fsf@gmail.com> <878qrxoayj.fsf@gmail.com> <8734i5o6wc.fsf@gmail.com> <87cyh9mpn5.fsf@gmail.com> <874j2l1hei.fsf@protonmail.com> <874j2lmd37.fsf@gmail.com> <87msgdkt29.fsf@gmail.com> 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="17101"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Pip Cet , Eli Zaretskii , spd@toadstyle.org, emacs-devel@gnu.org To: Helmut Eller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 30 18:42:37 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 1tSJmm-0004KV-EL for ged-emacs-devel@m.gmane-mx.org; Mon, 30 Dec 2024 18:42:36 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tSJm3-0008RL-6o; Mon, 30 Dec 2024 12:41:51 -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 1tSJm0-0008PU-1F for emacs-devel@gnu.org; Mon, 30 Dec 2024 12:41:48 -0500 Original-Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tSJly-0006WZ-Ch; Mon, 30 Dec 2024 12:41:47 -0500 Original-Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-5d3e8f64d5dso16430300a12.3; Mon, 30 Dec 2024 09:41:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735580504; x=1736185304; 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=jW7WyDpQwa9+S0m5Fet3wPFn+0SmMJ+j51+TSrCOiQk=; b=JbyIHSg8vHQoHeodhZ5sR4IeHZl6LLZUBusMg67YzKkDpN6HHzRnoYjQQ/JlBo7E9a vCY3HitNAdx4WkdDv6BlhdIEM0+xe4j2jMc8RX8W6TYRQzaE2qVpf0a+OXN8oT7LlSWg 2/2mq9tX/wR1/egKNm9jx0E/9YP0moDZgDoU4icKtukKZGmL88Lho9HsTURlkNvwu8LD +8UK/srVjXs0NeEohZIDRdGdS9q9mtd0cKImTBgdhVQeCUbYvpogjjOSfoWc+4YGScVi wf6djItiBQz02AOnC7BovNUfusK4PPDb24+8wk2s5LZ3Rv/IQozGEUkUoN4uZklZapMq X/WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735580504; x=1736185304; 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=jW7WyDpQwa9+S0m5Fet3wPFn+0SmMJ+j51+TSrCOiQk=; b=jQjLsqkCSZP7vwA9u2WvhCVBPSXMc0ZEi0Fb9wL60WncVa9xyGWvSblM59IkUj3jHe HRUphiNZ0i9intrED41z/vzD3bv7qutnM0ObksHFCVVlddKi5A3WDuu9PZHaHQIXYBeO SHL0nZgB8wqKnbE7op6r2ek3YVZUr+Kz+Mr0VRnJsMc5CQzqz+ebgxpc1Lpi5vBaQDLE +/dP/QnAqiLVedTvcARV3OwcNbCqIg5o7UEDFPFsvEuDvF3T217zmuwPCrsBnkmOIYf+ 1n4e87ivmxcXNuipNDjto2y/EddKN5G5DUbRkL25vozqbRyaAodOndNcrrlVMru/DfZp SPGw== X-Forwarded-Encrypted: i=1; AJvYcCW+9xJL5mU0ZK2eyaBREunign5kBLh7jtcjZJrBLAzSRWeP0HVyrADXOXRD4VUu3tLCdnYq@gnu.org, AJvYcCX3s9TAsT6WafxUO8pRWUO/V3j8urg7IKU92p4WWVkYU4UEjeETM4TiV07Xbs9pZBwD9Ze3RS7roIYWNPw=@gnu.org X-Gm-Message-State: AOJu0Yy0ERmlLmvjPzBCyLNNpW3u0k1ygzyayPn4tpRpkMMeHU/J/X5D 5nMn44/oub0sqq0Nn+4lLbtJEGyu1ecNb5dJGT2kx/FseEP1DcSqYp0/Vg== X-Gm-Gg: ASbGncvTjlwbv8nuQAuFvRBEz+6zpZAqj37l4DpzQ/POaXYp5IrPM4by+nuwsYuVpQk wASo1GMc/eoZTzUaplh3DOz3XLjwuv8/txw447yY45/HcVJT9kHEAe19aU3H7O2tN/tx/WBNSxY P765U8MYoHwynn8gSXTy52G4u93A3VilkOxM+tlInY5lQ/GLmq+QbNvJkrc2qdBG36URQMr9z4T YxEdHKYcPEK3wLxFHpDKEizo+sDZDvGrty8/6QQndqvU1xswgP1oqTv2EFF8H7dpMQAcHmz96XA U9Y/T30d9KTXcjdRZT9ortR6Z52I955Q21Ac2svMvnqxxodpw31HdJrts7nimllJ X-Google-Smtp-Source: AGHT+IG4cKgkcnzwFA8edfZMB6IOaKcVRywjNlLRxVHJeKmMJcIVGwRK1zt6Q8DjwJlEQs2zKIOOpg== X-Received: by 2002:a05:6402:2315:b0:5d4:320:ee66 with SMTP id 4fb4d7f45d1cf-5d81de5d419mr25349227a12.31.1735580503903; Mon, 30 Dec 2024 09:41:43 -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 4fb4d7f45d1cf-5d80676f08dsm15397084a12.21.2024.12.30.09.41.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Dec 2024 09:41:43 -0800 (PST) In-Reply-To: <87msgdkt29.fsf@gmail.com> (Helmut Eller's message of "Mon, 30 Dec 2024 17:57:02 +0100") Received-SPF: pass client-ip=2a00:1450:4864:20::52a; envelope-from=gerd.moellmann@gmail.com; helo=mail-ed1-x52a.google.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 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:327454 Archived-At: Helmut Eller writes: > On Mon, Dec 30 2024, Gerd M=C3=B6llmann wrote: > >> Bool (LockIsHeld)(Lock lock) >> { >> AVERT(Lock, lock); >> if (pthread_mutex_trylock(&lock->mut) =3D=3D 0) { >> Bool claimed =3D lock->claims > 0; >> int res =3D pthread_mutex_unlock(&lock->mut); >> AVER(res =3D=3D 0); >> return claimed; >> } >> return TRUE; >> } >> >> There might be a small window after pthread_mutex_trylock and being back >> in the signal handler. Can anything happen in this window? >> >> If no other Emacs threads are running, and the Emacs thread is in the >> signal handler, we can trust the "false" from the mps_arena_busy. > > Theoretically, a signal handler could interrupt the Emacs thread and > lock the mutex without unlocking it. That would be a very unusual > signal handler. I hope no other surprises happen in signal handlers. > > Helmut Right, that one I forgot. A nested signal may interrupt the signal handler and acquire the lock in its signal handler but not release it. The effect would be that the original signal handler would see a false from mps_arena_busy which would not the truth. I'd call that a bug in the nested signal handler.