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: Fri, 27 Dec 2024 17:19:58 +0200 Message-ID: <86ed1tw3tt.fsf@gnu.org> References: <87o713wwsi.fsf@telefonica.net> <87ldw7fwet.fsf@protonmail.com> <87a5cnfj8t.fsf@protonmail.com> <86seqe4j4f.fsf@gnu.org> <87ttaucub8.fsf@protonmail.com> <87pllicrpi.fsf@protonmail.com> <864j2u442i.fsf@gnu.org> <87a5ch5z1b.fsf@gmail.com> <86y101wlsr.fsf@gnu.org> <87wmfl6utk.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10886"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gerd.moellmann@gmail.com, pipcet@protonmail.com, ofv@wanadoo.es, emacs-devel@gnu.org, acorallo@gnu.org To: Helmut Eller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Dec 27 16:20:31 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 1tRC8d-0002gt-3l for ged-emacs-devel@m.gmane-mx.org; Fri, 27 Dec 2024 16:20:31 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRC8G-0002Gh-IR; Fri, 27 Dec 2024 10:20:08 -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 1tRC8E-0002GK-4I for emacs-devel@gnu.org; Fri, 27 Dec 2024 10:20:06 -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 1tRC8C-0001ob-Sw; Fri, 27 Dec 2024 10:20:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=d1MmTugL70WnBVt+q2kWOB56SuvPlkGf8/8N5QIZt14=; b=LIpah3URQ0Up HgtHzByFszDl2itrcOpz858htD1KVmamkugF/RLuYnhT5PTUwrpYI7HkE682wcapQQLwGaAVdJe6Y h7peNY8CLzDVrglnljizZvXy7JYWgoSUegtRvaz63kploe9gucHZX69vWSewocGnXO/6RU8ROy8jD PGQCVfGMbhNnxrVZQK8xS93DWia3PhucqcUMcVfwcxjrc+m84CBDTQ/3+x4z/MnZ5h6r1uqxKlZpm 5vyuGRDk32Wqv3ABHNlsir2SuyB4PFVduaqMGSP2iP9YjOkbG2IPIwnZtx2v9wswCloUYXbmXEO9X eIxTZlo5cbfa/Pa0HwYQhg==; In-Reply-To: <87wmfl6utk.fsf@gmail.com> (message from Helmut Eller on Fri, 27 Dec 2024 15:53:43 +0100) 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:327203 Archived-At: > From: Helmut Eller > Cc: gerd.moellmann@gmail.com, pipcet@protonmail.com, ofv@wanadoo.es, > emacs-devel@gnu.org, acorallo@gnu.org > Date: Fri, 27 Dec 2024 15:53:43 +0100 > > On Fri, Dec 27 2024, Eli Zaretskii wrote: > > > But I don't understand > > why you need that pipe: doesn't pthreads allow one thread to stop the > > other? If so, just make the "profiler thread" stop the main thread > > instead of your step 2, and resume the main thread instead of your > > step 4. Am I missing something? > > You mean there is a phtread_stop function that is similar to > SuspendThread on Windows? I've not found anything like that; but that > doesn't mean that there isn't one. The Linux man-pages for pthreads are > notoriously useless. This: https://stackoverflow.com/questions/18826853/how-to-stop-a-running-pthread-thread seems to say you need to call pthread_kill with SIGSTOP/SIGCONT, he-he. > I like the pipe because it's a signal safe and thread safe communication > mechanism. It avoids the need for mutexes or stdatomic stuff; that's > best left to wizards. This could work for Posix systems, but I don't think it works for Windows to have a pipe between two threads. And Windows already has SuspendThread, so maybe a pipe is not needed there.