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: Some experience with the igc branch Date: Sun, 29 Dec 2024 07:47:01 +0200 Message-ID: <86seq7qbvu.fsf@gnu.org> 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> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17448"; mail-complaints-to="usenet@ciao.gmane.io" Cc: eller.helmut@gmail.com, gerd.moellmann@gmail.com, pipcet@protonmail.com, emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Dec 29 06:47:37 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 1tRm9I-0004QQ-Dq for ged-emacs-devel@m.gmane-mx.org; Sun, 29 Dec 2024 06:47:36 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRm8s-0007Vo-L2; Sun, 29 Dec 2024 00:47:10 -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 1tRm8p-0007Vc-Nh for emacs-devel@gnu.org; Sun, 29 Dec 2024 00:47:08 -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 1tRm8o-0006dN-NH; Sun, 29 Dec 2024 00:47:06 -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=II2u+AN/DKXf3PiPSiWx4FMOcSs0a63Ij5BnYa4UJ04=; b=maf5QJk97iJL uvBUDHsz14yItsTsV0fKG90eZbAx5DU/IeeYWjv6g7FHI2eBN8Q570EgEM5G09tQsHo4uy2DVw3Bt kNL3DlI317N28ykLEsP77EMNmR1DtpjwqMZ405SyC9qi1y+b2XiB3ovH60095ibQN5oEpJ52Q0k2u gQusSLaZfKdUo0X8tGGzccGtY1sqST1Qn5JeVVLJnj8y3/xdVQaFspvEi7qqqHPoeQXvC1n+5oZJm vOq7JYVcfSxpkOdsoLq4DJeAk8LxY+0O6bJbKv+LEYIM0rlsRriczKmOru58fh8m4qD8VwKTWhypm RVRvwPzLj11apjTrAh+ytQ==; In-Reply-To: (message from Paul Eggert on Sat, 28 Dec 2024 12:44:29 -0800) 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:327311 Archived-At: > Date: Sat, 28 Dec 2024 12:44:29 -0800 > Cc: eller.helmut@gmail.com, gerd.moellmann@gmail.com, pipcet@protonmail.com, > emacs-devel@gnu.org > From: Paul Eggert > > 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. OK. > >> 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. OK, then this is just terminology differences. What you describe is the expected result. > >> 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. Yes, that's the purpose of the global lock: a Lisp thread can only run if it acquires the lock. Thanks.