From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: SIGPROF + SIGCHLD and igc Date: Tue, 31 Dec 2024 16:20:16 +0200 Message-ID: <86cyh8lysf.fsf@gnu.org> References: <87o713wwsi.fsf@telefonica.net> <87bjwvedzn.fsf@protonmail.com> <86ttanqc0p.fsf@gnu.org> <87bjwu2pb6.fsf@protonmail.com> <86pll9nrgz.fsf@gnu.org> <87seq5xgpt.fsf@protonmail.com> <86ikr1njuv.fsf@gnu.org> <875xn0rihm.fsf@protonmail.com> <86y0zwm3nh.fsf@gnu.org> <87ttakneh3.fsf@protonmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39563"; mail-complaints-to="usenet@ciao.gmane.io" Cc: eller.helmut@gmail.com, gerd.moellmann@gmail.com, ofv@wanadoo.es, emacs-devel@gnu.org, acorallo@gnu.org To: Pip Cet Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 31 15:21:40 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 1tSd7r-000ABf-Qc for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Dec 2024 15:21:39 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tSd7f-0001Vm-KM; Tue, 31 Dec 2024 09:21:27 -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 1tSd7O-0001Sg-C6 for emacs-devel@gnu.org; Tue, 31 Dec 2024 09:21:16 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tSd7N-0003QM-KG; Tue, 31 Dec 2024 09:21:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=WtB4uVa65HpRWQ6jNoybUsxfiXN88taVY2avbkjTRH4=; b=foq3HdfZExORFQa4dwxi BwVma9NHTEXo0xmp1eaNRsAhUNxUup5XI4SXKPFsUVTpbMnHIWEibIiwQXS/7qD+hv4CJDJvuaUnj NN/FyobKB5CKJvOjjl6WGXM/ug34LakDl2huheLuxvkUWKSeGfurMMgYP2oVkiHWSd4/wFb6A1EVe FJewNGJw0JlMkCl7GPhtICINaOnndn2GZhj0mTuAhIlJbjTy+IYabxC4L2DUh92c36wLBMGROWAMN /aGzqQJYm6sTlU8FQvGz3rGtrRcSXy6JgXqZwUdqoEx9Q/UmpGljQhpuXgjJRnyoeSsrCrrmA0TM0 2ALnm0t23LK/RQ==; In-Reply-To: <87ttakneh3.fsf@protonmail.com> (message from Pip Cet on Tue, 31 Dec 2024 13:57:09 +0000) 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:327511 Archived-At: > Date: Tue, 31 Dec 2024 13:57:09 +0000 > From: Pip Cet > Cc: eller.helmut@gmail.com, gerd.moellmann@gmail.com, ofv@wanadoo.es, emacs-devel@gnu.org, acorallo@gnu.org > > "Eli Zaretskii" writes: > > >> > If we are on another thread, we know that, and can delay running the > >> > body. Or we could just run the body (all the signal handlers we have > >> > that I know about don't care: MS-Windows already does that). So this > >> > problem doesn't exist in practice, IME. > >> > >> Your (second) suggestion was to run the "signal handler" in parallel to > >> the main thread > > > > Yes. > > > >> which continues to mutate Lisp data. > > > > No. > > The main thread continues to mutate Lisp data unless we stop it. This seems like a misunderstanding: I was talking about what the signal handler does, not about what the rest of the main thread does. What the signal handler does is under our control. > Your > proposal did not include that bit, which is hard to do on POSIX systems. Which bit is that? > But the rest of your email makes it sound like we agree we should > improve the current code ((1) on my list), which handles signals on the > main thread while it is suspended. Let's do that rather than arguing? I believe Helmut is already trying. > > Doing that from a signal handler is a definite no-no, certainly > > if we call the handler from a non-Lisp thread. The only signal > > handler which currently does touch Lisp data, or comes close, is > > SIGCHLD. The MS-Windows emulation of SIGCHLD runs the handler > > ??? SIGPROF looks at the specpdl? We already have a solution for SIGPROF, and part of it is even already installed. > > And saving buffers generally must allocate memory. So it is not easy > > to make this reliable enough, it needs very careful programming and > > probably also some small reserve of memory ready to be used. > > We already have code to switch to malloc when IGC dies. If you run out of memory, malloc won't help much.