From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.devel Subject: Re: igc, macOS avoiding signals Date: Tue, 31 Dec 2024 10:51:30 +0100 Message-ID: <87h66kfae5.fsf@gmail.com> 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="36782"; 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: Gerd =?utf-8?Q?M=C3=B6llmann?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 31 10:51:55 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 1tSYuo-0009Ob-N5 for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Dec 2024 10:51:54 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tSYuY-00028Q-0T; Tue, 31 Dec 2024 04:51:40 -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 1tSYuW-00027G-3C for emacs-devel@gnu.org; Tue, 31 Dec 2024 04:51:36 -0500 Original-Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tSYuU-00025e-73; Tue, 31 Dec 2024 04:51:35 -0500 Original-Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-aab6fa3e20eso1629342266b.2; Tue, 31 Dec 2024 01:51:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735638692; x=1736243492; 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=EJPqTcOLrysHZ3szmiGcjU1gr8baEW4/2Rrh/+xY/yM=; b=WvYikGj1oX5sBO4Eo+4qLHdlynwOhqc9HyfjKq4LWOV/fkWe/ykIi7CR+ZTPOSM0us SOHjhlLop0ju8CR2IPIuiBjAbETJUqB2MC30Ukxc4v+S4gCLRdkOO7pbb2BCRbyxbwzd KnP7VUghih5o1yy1aPPyFgKZm1Aj6Tw9iWgc7jvw3orFkENvu8zTeMygsHCSA5RYJAYn ZnCzRkJ8lt7t5eOebEcE+QK8US6CkAYWUUCHuGw5z2JwhpJ8O+gNsBZI5h7kpwgY5xYW BOUsnpnb79lF/ykRRRikMGR7j89TWEFUtdr0Qha4ELosRUzon1fez/ZGV9rrhjcXd9JT cIzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735638692; x=1736243492; 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=EJPqTcOLrysHZ3szmiGcjU1gr8baEW4/2Rrh/+xY/yM=; b=TqD9sDqi2bS855YeldW8UeFjw5NttAZjImC/FD3m30945s9aJ1W2qNJWOPB9L8NXCm 4ZznEUscaJ4vqHsLeO7g/pqGw5JYyB1Qhblcge+yHfQwsRKJ+kC/fy1951yHDpjOo59R x0YtW1IJH3ETygKfN32ERDU0zoWZIlJdRfbrUXevtTa2jY6+dX++IqJId1rR0OKbqsdD PWgVHCIjUEuNCj8yggA02o0tGjbBNkOBxKyqKOxTE7apLMMy7ttuOhiIdiPIR3rrofak 7A+Ceb7gFUbvU6zgJgvIWGpDsivd4PGiJc+e1OAR5BxtCo+9acd0IzQ7qx5pSXsNUm/2 sX5w== X-Forwarded-Encrypted: i=1; AJvYcCX7xbZHQWkMMaZqKrJ4s5O0DkSfzNiqKgVHu+H5hVcRd6eiz3zZjZziQWPq9xP+qE/Tokv4dr27X/O8jw==@gnu.org X-Gm-Message-State: AOJu0YyoHCeRK6H7S47Ef1iYMTO5Z+WHCcImcGXRd54Kyn/s/krzNJEP nG5fZz3+WJkHJe4jD5V7c3/JXQ21dJ83YWpaNotABedF7dGVapbgZuJCDktD X-Gm-Gg: ASbGncvdD4kQBBf21Y9mG2oq4k0Qxbxc8LY4SF1j7Rc8SnM11GvEJ02RYYi8oAcTsRv F+OuIjBpuXXfwak8wnuoy+Bf3p/6qg85yIFNqURpFDo86DX+RAUDxVOy2UpbkhtkIWH9+WSsZ0a +EWocKxoBaCjtw6CxFsZGZ1hho+b6AaBNvLycC06ZAeKLSg36LtkLAZgKVckSoAsn5jW4mSQhyp 5gbZ4R586/yQZ/2dMUwl95oz7vvRiAgPZt234QzEjqGYbMENR9U9bE= X-Google-Smtp-Source: AGHT+IHmueloiYRLUPVJEIwHUwKLnqFyo8IKAdWGq4uGbjFxsBofe4m6Mvhaes/75I8qiz7v0xBHXQ== X-Received: by 2002:a17:906:7310:b0:aa6:7165:5044 with SMTP id a640c23a62f3a-aac3444c2eemr3273540866b.44.1735638691737; Tue, 31 Dec 2024 01:51:31 -0800 (PST) Original-Received: from caladan ([31.177.115.143]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aac0e894c2esm1588492166b.67.2024.12.31.01.51.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Dec 2024 01:51:31 -0800 (PST) In-Reply-To: ("Gerd =?utf-8?Q?M=C3=B6llmann=22'?= =?utf-8?Q?s?= message of "Tue, 31 Dec 2024 10:19:15 +0100") Received-SPF: pass client-ip=2a00:1450:4864:20::62a; envelope-from=eller.helmut@gmail.com; helo=mail-ej1-x62a.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:327485 Archived-At: On Tue, Dec 31 2024, Gerd M=C3=B6llmann wrote: > Helmut Eller writes: [...] >> 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?) [...] > 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? Judging from the source here https://sourceware.org/git/?p=3Dglibc.git;a=3Dblob_plain;f=3Dsysdeps/nptl/b= its/struct_mutex.h;hb=3DHEAD and here https://sourceware.org/git/?p=3Dglibc.git;a=3Dblob_plain;f=3Dnptl/pthread_m= utex_trylock.c;hb=3DHEAD I would say that the mutex is a struct with multiple fields and that pthread_mutex_trylock is neither a syscall nor an atomic instruction. The struct may simply be in an inconsistent state at the time t0, the beginning of the SIGPROF handler. Helmut