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.bugs Subject: bug#72689: 31.0.50; Proposal to improve string-pixel-width Date: Thu, 22 Aug 2024 06:43:40 +0300 Message-ID: <86seuxte6r.fsf@gnu.org> References: <54d1d667-55d0-41fc-9eec-38b3881d799b@orange.fr> <86bk1q1m0l.fsf@gnu.org> <8634n219b1.fsf@gnu.org> <35119d55-c582-4f4b-b80d-d94fc6b8886c@orange.fr> <86jzgauiav.fsf@gnu.org> <358cf360-aa39-4551-aa8f-46543df07eda@orange.fr> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35998"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 72689@debbugs.gnu.org To: David Ponce Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 22 05:44:42 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1sgykb-0009Eg-7y for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 22 Aug 2024 05:44:41 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sgykF-0004k3-Ja; Wed, 21 Aug 2024 23:44:19 -0400 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 1sgykD-0004j7-QL for bug-gnu-emacs@gnu.org; Wed, 21 Aug 2024 23:44:18 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sgykD-0005pR-HE for bug-gnu-emacs@gnu.org; Wed, 21 Aug 2024 23:44:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=ojmgelX/weNOTgJwRg9IcxpE8gQ+L+lOoiieHySbpCg=; b=ZLG2cRZDKer4Xo/7ooPEDTSrg+0UwOaN3TcLs2ZcnVhLjnRkPk4gsFrXtXIz+P2Q0dZ01/uWexoR/o1WmiydWsPDt2EbjpFLdf7Q8Cw/rIz3tMDPiZc9+4s7tE4/RMMkO2KQehFpWUPss48SawfO5VcP+YiI7j3lzGjp7DGNbdY94mKhJvQOUute6qXN7aZUU23OS5N4Qw0dCe4PiAm13aG8BfvH6Yar8ch5G6GcW33cm+iXiYhxmxDDFBvLF0grnXhDb5akYhJYXnu2oGODl2fRTOTx/yv8OqZ+wN/AcS4mXX9yTUsUsd2ZHF/7+ue0Did5P914nZ2FOVvRpxNdfg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sgykw-0002cI-Cj for bug-gnu-emacs@gnu.org; Wed, 21 Aug 2024 23:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 22 Aug 2024 03:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72689 X-GNU-PR-Package: emacs Original-Received: via spool by 72689-submit@debbugs.gnu.org id=B72689.172429827610005 (code B ref 72689); Thu, 22 Aug 2024 03:45:02 +0000 Original-Received: (at 72689) by debbugs.gnu.org; 22 Aug 2024 03:44:36 +0000 Original-Received: from localhost ([127.0.0.1]:36543 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgykV-0002bJ-Hu for submit@debbugs.gnu.org; Wed, 21 Aug 2024 23:44:35 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:35180) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sgykT-0002b5-A6 for 72689@debbugs.gnu.org; Wed, 21 Aug 2024 23:44:34 -0400 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 1sgyje-0005mC-1x; Wed, 21 Aug 2024 23:43:42 -0400 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=ojmgelX/weNOTgJwRg9IcxpE8gQ+L+lOoiieHySbpCg=; b=Khox7rl0S/v1 l5oNiuV7RvLJj9eHZP3K6VIASMrvVz4XLEDAi9sGjez7jayNmoDqPX/SstZKo7PbLLjjeLYIAhA5a GmXLgr0eBoZShNqk0ZKON8r8M9HAG4GEpaIm2LqJblF30Kkf6QWIEDWcL58hgOIZLbMSuX9Ym2tR1 /CfVUJUKvJIw3qGIhv53bPtjTmIcKI0c56ocEEtbjA5QzeubzmbeDh522CSbShWiuThkd5cXwlZwc ueFE4klfJlAuQZuzJ7OSzABMMJGEKFzlIFBngUgvDjJRcd5yHuMioLIjvJMA8Nc5XOqV2E/KCUA51 0DIxvDmY5WCtr1WkcFWruw==; In-Reply-To: <358cf360-aa39-4551-aa8f-46543df07eda@orange.fr> (message from David Ponce on Wed, 21 Aug 2024 22:43:08 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:290512 Archived-At: > Date: Wed, 21 Aug 2024 22:43:08 +0200 > Cc: 72689@debbugs.gnu.org > From: David Ponce > > On 21/08/2024 3:17 PM, Eli Zaretskii wrote: > > Thanks, but using a mutex is overkill: there could be no race between > > two or more threads in this case in accessing the buffer-local > > variable, because only one Lisp thread can be running at any given > > time. So the simpler method of testing the "busy" flag should be > > sufficient. > > I used a mutex to protect the global variable `work-buffer--list' > (which holds the list buffers available to be reused) against > concurrent accesses during the very simple update operations: pop an > available buffer, push a released buffer to make it available. > > Of course, if you guarantee that only one Lisp thread can be running > at any given time, protecting `work-buffer--list' against concurrent > accesses is not necessary and mutex can be removed. Yes, I think so. > Here is the new version without mutex (no significant impact on > performance compared to the version with mutex): Thanks, LGTM. > Should I prepare a patch of subr-x.el to include both the proposed > `work-buffer' API, and an implementation of `string-pixel-width' using > it? Yes, please. And the macro itself needs a NEWS entry, I think.