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: Tue, 31 Dec 2024 10:19:15 +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> <86h66lnjrt.fsf@gnu.org> <868qrxnfrw.fsf@gnu.org> <87a5ccl2zx.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="22438"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , pipcet@protonmail.com, 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 Tue Dec 31 10:20:27 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 1tSYQM-0005cA-Ns for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Dec 2024 10:20:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tSYPY-0002I5-Mh; Tue, 31 Dec 2024 04:19:36 -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 1tSYPM-00027b-35 for emacs-devel@gnu.org; Tue, 31 Dec 2024 04:19:26 -0500 Original-Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tSYPK-0006er-2F; Tue, 31 Dec 2024 04:19:23 -0500 Original-Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5d7e3f1fc01so19661433a12.2; Tue, 31 Dec 2024 01:19:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735636757; x=1736241557; 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=oJy5KtLlLWGI9dBQE5dwkx+pvT2dNi3Rnu5riLEUMJ0=; b=WMTRVlxi5MyfmQBnqKIpIVQrCFf1ISYLXg5Sri/rgQ68s4htR+xYSK6ifWMK+SJTNP bwYPhNDRMqgiCZNM091xpSqegtE1aVfwyxomfV1SO5chI3h2GbU0J6XJ6PDWx2UgmZjH ZKsf7IVB1k9atNOOZl9H84krfgOmu+W4lv1ZUauwFRJMcUu2c39YNJxmmumno7EpiANg sbQSBvheVnTE+mk2x6unaB6VXYBgpNcRonc00KmHwS6szA0Q/Lq3zd28GXnqK3pF9Lcp jhA3+aNFLCxVJyfmBtWvwwCm8TTcmkiMmBvec1bHF7jUFi2Kb7ZqFEaIV/P7zCz6xrMf f6sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735636757; x=1736241557; 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=oJy5KtLlLWGI9dBQE5dwkx+pvT2dNi3Rnu5riLEUMJ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907:7b9f:b0:aa6:800a:1295 with SMTP id a640c23a62f3a-aac27026cf3mr3074137166b.5.1735636756817; Tue, 31 Dec 2024 01:19:16 -0800 (PST) Original-Received: from pro2 (p200300e0b7216c0021e5e367c6afc189.dip0.t-ipconnect.de. [2003:e0:b721:6c00:21e5:e367:c6af:c189]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aae8b802f64sm1359118366b.108.2024.12.31.01.19.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Dec 2024 01:19:16 -0800 (PST) In-Reply-To: <87a5ccl2zx.fsf@gmail.com> (Helmut Eller's message of "Tue, 31 Dec 2024 08:34:42 +0100") Received-SPF: pass client-ip=2a00:1450:4864:20::534; envelope-from=gerd.moellmann@gmail.com; helo=mail-ed1-x534.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:327483 Archived-At: Helmut Eller writes: > On Mon, Dec 30 2024, Gerd M=C3=B6llmann wrote: > >> Eli Zaretskii writes: >> >>>> From: Gerd M=C3=B6llmann >>>> Cc: Helmut Eller , pipcet@protonmail.com, >>>> spd@toadstyle.org, emacs-devel@gnu.org >>>> Date: Mon, 30 Dec 2024 19:37:38 +0100 >>>> >>>> So, to summarize, everyone agrees with Helmut? > > Except the POSIX police: it says that pthread_mutex_trylock isn't async > signal safe. I suppose this also makes it's unsafe to use MPS's fault > handler in an async signal handler. Bummer. (Does the police take > bribes?) Thanks. I guess it shows that I couldn't keep up with my mail, sorry for that. So we have this picture, I think t1 t2 t3 ------------|------------|---------------------|-----------------> t signal pthread other stuff signal handler handler trylock until return to branching calling signal handler on result of busy mps_arena_ busy We have a window [t1, t2] where the nested signals lead to undefined behavior. and [t2, t3] where threads and nested signals can come into play, but that's not a problem, iff signal handlers don't leave a lock behind them. Hm. Have you perhaps looked at a pthread implementation, what such a mutex actually is on Linux? >> >> Now the question is if that's what Helmut was describing. > > Yes, that's what I meant. Thanks. > I wonder if the backtrace that we see in the signal handler is any > different from the backrace that we would see at the next safe point > (i.e. the next time maybe_quit is called). If the backtraces are the > same, then we could record the backtrace there; that would be much > nicer. Yeah.