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: Sat, 04 Jan 2025 15:55:29 +0100 Message-ID: <87ed1iocgu.fsf@gmail.com> References: <799DDBC5-2C14-4476-B1E0-7BA2FE9E7901@toadstyle.org> <87msgdkt29.fsf@gmail.com> <86h66lnjrt.fsf@gnu.org> <868qrxnfrw.fsf@gnu.org> <87a5ccl2zx.fsf@gmail.com> <875xn0p3l1.fsf@protonmail.com> <86ldvwm190.fsf@gnu.org> <87cyh8nczh.fsf@protonmail.com> <867c7fncom.fsf@gnu.org> <87pll3ivzs.fsf@gmail.com> <87wmfaof1l.fsf@gmail.com> <868qrqd5oa.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38006"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: pipcet@protonmail.com, gerd.moellmann@gmail.com, spd@toadstyle.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jan 04 15:56:27 2025 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 1tU5Zj-0009nc-N7 for ged-emacs-devel@m.gmane-mx.org; Sat, 04 Jan 2025 15:56:27 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tU5ZA-0001Q8-5o; Sat, 04 Jan 2025 09:55:52 -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 1tU5Yv-0001NU-GR for emacs-devel@gnu.org; Sat, 04 Jan 2025 09:55:45 -0500 Original-Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tU5Yq-0002Pe-JO; Sat, 04 Jan 2025 09:55:34 -0500 Original-Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4361815b96cso86415545e9.1; Sat, 04 Jan 2025 06:55:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736002530; x=1736607330; darn=gnu.org; h=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=NqL+GIw9Ala9RYLKGL37+57WyxKJ1jSaeaNJxh87WQY=; b=ijdi/hg5IA9Vl5fotM+5s1tHD/uqk+5go+6ZnzJx95FmwtOdZ7mVvBz2gBohgIQ6+t eHQYyn1U4VpbdFjFpnDqJmGfX39C2SdXLXVm//CkMsoYSG7hKIbYzvBXThB3Okj8iC+I p9oj6A4QmxR7G+ZzYrRl2PEdNrZRtXo1dfAlILI8Zkg7sGY1juMdN9Xq/zf8NA8e2K30 h6xkuybri45q+LvJO7yKUoq8OHrT8QvRjSAKGP6cJSbEmO9SYsouq0d5ZGjGR9LDVy4t mlwcLTxL2QGaDyaQbvbM1Xb53TUZJK+iQ17NXhSmr67NQG/SVXPNr5IHbo6F1O6ODPrQ 1f1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736002530; x=1736607330; h=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=NqL+GIw9Ala9RYLKGL37+57WyxKJ1jSaeaNJxh87WQY=; b=EngUboO0/c43MhWhfZryA/sLf1F8QirPwM4EIiIHlIFfCImQgr/9sTAr8GVPtJniO8 wX3iL2hYQu67uUtdMDLtOaEc7EkWbVE0R+9ZpAlzCaK2Z0NNRirMUStc0oYzr2ur0j8o +CX2nUq+rCDudRgY4GaxAAjcZK1iQ01/KcJsx1LZ0z03qwHvTquByCxSaasysuWCm8fK rZmwEY5MCm6l7lNTpZyOtsB7T5Anji5qkqvAqr/A7ehsNuA0+jnjzlv5Q/knbpXOnzKU PeDvDLQcmBcpE9qLmjD5cO3nCzWjwIIr2E94l3SaUu7BY89734AsfaZTHj1cZIC+Uxe8 5dnw== X-Forwarded-Encrypted: i=1; AJvYcCWSVqoMGBl0tc2bpgjB+Ya3RYN7bHfX+VI2jqZ2T1xH+w97cXRZAkn4eecE8+IxwOqV0d1HRLNkkvZuOw==@gnu.org X-Gm-Message-State: AOJu0YzvZp3nXPPpzfiuRbf7naZYCiuxS6uJ9jYn3Z4OuPRuNxO7v2+f NDjser2jd3Q0+b0NXqdTi/DoKUGLktrzu+4g2bx6HB6ly38RPXjzYRXquQ== X-Gm-Gg: ASbGnctUzpZXOuq5/l7u0iSJ9YvGLS41Tk8VCbAvK9wFzwWcDnZRURVXEZWGUYRruws hIedXV8IM6ASkQeGsYhbG+J2XwdvjgxHl7PhkCe5eAUa+UOUsv6993N8BDvmiIWWlInrBHOeQIE bLkEKs/g7l9CyeDFOHJmvhBaXHEAdj7LRW4R3Zrvc2+YvuVM3xZpNDPiwyaxhHxdyePmd50H7Sy SuIDzQu2QgP8zHZ22p94FTViLEM/IojAUzmkgpwkXereeER99Un3A== X-Google-Smtp-Source: AGHT+IHCDBL7Q+dGFwhz/j0Rvimc/F4UAAu6/VvUgMfq73TDzqEDi8Pblp6fRe5+4cJMBIvYMb5Cjg== X-Received: by 2002:adf:c081:0:b0:38a:4184:1529 with SMTP id ffacd0b85a97d-38a418415ddmr19587554f8f.12.1736002530369; Sat, 04 Jan 2025 06:55:30 -0800 (PST) Original-Received: from caladan ([89.107.106.84]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c89e375sm44048322f8f.73.2025.01.04.06.55.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jan 2025 06:55:29 -0800 (PST) In-Reply-To: <868qrqd5oa.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 04 Jan 2025 16:17:41 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=eller.helmut@gmail.com; helo=mail-wm1-x32d.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:327668 Archived-At: On Sat, Jan 04 2025, Eli Zaretskii wrote: >> WDYT? > > I'd make these extra calls only call the SIGPROF handler if the > counter says some signals were missed. There's no need to affect > other handlers without a good reason. If I had my way, I would merge Vquit_flag and pending_signals into a word-sized bitset like so union pending_signals { uintptr_t sigset; struct { uintptr_t quit:1; uintptr_t profiler:1; uintptr_t child:1; uintptr_t alarm:1; uintptr_t io:1; /* other signals */ } s; } pending_signals; Then maybe_quit and process_pending_signals would be merged into a single function that look like this: void process_pending_signals (void) { union pending_signals signals = pending_signals; if (signals.sigset) { pending_signals.sigset = 0; if (signals.s.quit) process_quit_flag (); if (signals.s.io) handle_async_input (); if (signals.s.alarm) do_pending_atimers (); if (signals.s.profiler) process_pending_profiler_signals (); /* other signals */ } } If no signal is pending, this only needs to load and test one word instead of two. If only one signal is pending, then it only calls that handler. For the rest, I'd hope that a modern branch predictor determines quite accurately which handler will mostly likely be called. Helmut