From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: Some experience with the igc branch Date: Sat, 28 Dec 2024 12:44:29 -0800 Message-ID: References: <87o713wwsi.fsf@telefonica.net> <87ldw6as5f.fsf@protonmail.com> <86o7112rnq.fsf@gnu.org> <867c7p2nz4.fsf@gnu.org> <861pxx2lh7.fsf@gnu.org> <86ldw40xbo.fsf@gnu.org> <86a5cj2a0e.fsf@gnu.org> <867c7n28sf.fsf@gnu.org> <877c7n962e.fsf@gmail.com> <8634ib24gp.fsf@gnu.org> <875xn75w7u.fsf@gmail.com> <86ttaryn1x.fsf@gnu.org> <877c7mzxbw.fsf@gmail.com> <861pxuzt61.fsf@gnu.org> <87wmfmy6mq.fsf@gmail.com> <86ttaqxybk.fsf@gnu.org> <867c7ly2v8.fsf@gnu.org> <86v7v4ut8w.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18784"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: eller.helmut@gmail.com, gerd.moellmann@gmail.com, pipcet@protonmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 28 21:44:48 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 1tRdfy-0004ko-Gl for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Dec 2024 21:44:46 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRdfq-0007Zh-5U; Sat, 28 Dec 2024 15:44:38 -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 1tRdfo-0007ZU-Q8 for emacs-devel@gnu.org; Sat, 28 Dec 2024 15:44:36 -0500 Original-Received: from mail.cs.ucla.edu ([131.179.128.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRdfl-0004ET-2g; Sat, 28 Dec 2024 15:44:35 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 79D123C00FA91; Sat, 28 Dec 2024 12:44:30 -0800 (PST) Original-Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id AN9wWiwRJN_s; Sat, 28 Dec 2024 12:44:30 -0800 (PST) Original-Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 0C6643C00FAAA; Sat, 28 Dec 2024 12:44:30 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 0C6643C00FAAA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1735418670; bh=QGFLDDwRvTkzDWEtcz+oCRnMT7XW4+OmZcHEsSlNjRc=; h=Message-ID:Date:MIME-Version:To:From; b=kG8pE8UZ6Zau6c8SJjZJWyJDgTb6qODoWj8SCqr77OFNVr7RNhu8LuMyrhIyHloHo gG4XxW5UXBqLeXl1fQbbESx+j6dgudjvYZI+0FRYDI115g8DYs6Tr0IEZV7MdmMWFN N+bLeEKlG8IXrOJUkUEzRf08MqErDfvS2iEGQ+N9FosvXDw1Ja7rLSZMDQ80cUVIVp 3QRXU9j4DLG6RrC300/lBdcnyRqQQZ+1v7Af2hibH9b3TV5zHvNvm0JnXKwBlGUcMk 12lLZpsw6RmyVWsYgVUKwURw90RPO7l3UGVeADAO6L0lBWYcmA1oDs2Y0WeIX6ui+j DWIZLqopKtBUQ== X-Virus-Scanned: amavis at mail.cs.ucla.edu Original-Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id h4SUG0IygKX5; Sat, 28 Dec 2024 12:44:29 -0800 (PST) Original-Received: from [192.168.254.135] (unknown [47.154.28.214]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id D13B43C00FA91; Sat, 28 Dec 2024 12:44:29 -0800 (PST) Content-Language: en-US In-Reply-To: <86v7v4ut8w.fsf@gnu.org> Received-SPF: pass client-ip=131.179.128.66; envelope-from=eggert@cs.ucla.edu; helo=mail.cs.ucla.edu X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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:327300 Archived-At: On 12/28/24 00:06, Eli Zaretskii wrote: > And when the thread to which the OS delivered the signal calls > pthread_kill to deliver the signal to the main thread, does that stop > only the main thread? That is, do other threads keep running? Yes. The main thread doesn't stop; it merely gets a signal queued for delivery. Eventually the main thread's signal handler will be invoked. >> I don't know how Lisp threads work. But if they are OS threads, then if >> the other thread has the lock, the main thread will remain stuck until >> the other thread releases the lock. > > Really? Why? The main thread is stuck in taking a mutex, which AFAIU > is a system call? Then delivering a signal to the main thread should > terminate the syscall, and the main thread should execute the handler > code for the signal it got delivered, no? By "remain stuck" I meant that the main thread will remain waiting for the lock if the signal handler returns normally. pthread_mutex_lock is not an EINTRish syscall: it does not fail with errno==EINTR when interrupted. Instead, if the signal handler returns normally pthread_mutex_lock resumes waiting for the mutex. In GNU/Linux, pthread_mutex_lock typically operates entirely in user space: no syscall is involved. >> Yes, but that's not the only reason. A quick look at the profiling code >> suggests that it is not thread-safe, so chaos would ensue if SIGPROF >> were not forwarded to the main thread. > > "Not thread-safe" in what way? Only one Lisp thread can run at a > given time, so some thread-safe issues should not exist in that case. I didn't know that only one Lisp thread can run at a time. If in addition Lisp threads can't be preempted by other Lisp threads being profiled, the profiling code is quite possibly safe to run in non-main Lisp threads, though this should be checked by an expert in that part of the code.