From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Cc: Paul Eggert <eggert@cs.ucla.edu>
Subject: single-threaded optimizations
Date: Wed, 03 Mar 2021 04:27:56 +0100 [thread overview]
Message-ID: <14551115.F8Qjx3YMge@omega> (raw)
In-Reply-To: <20210303002855.5819-1-eggert@cs.ucla.edu>
Hi Paul,
Paul Eggert wrote:
> + * lib/mbtowc-lock.h (mbtowc_with_lock) [USE_UNLOCKED_IO]:
> + Don’t bother with locks, since this app is single-threaded.
We now have two C macros which indicate a single-threaded application:
* USE_UNLOCKED_IO, used
- for unlocked <stdio.h>
- in regex
- in mbrtowc
* GNULIB_WCHAR_SINGLE, used in wcwidth.
This gets weirder over time.
Should we have one macro for each of gnulib's facilities (stdio, regex,
multibyte/wchar)?
Or should we have one macro in general? In this case I would suggest
to choose a more generic name, instead of USE_UNLOCKED_IO.
Recall that a general macro won't cut it e.g. for coreutils. coreutils
has multithreaded programs ('sort') next to single-threaded programs.
But coreutils wants to optimize wcwidth. GNULIB_WCHAR_SINGLE actually
means "assume that the locale has been set before the program becomes
multithreaded, and won't change afterwards". Similarly,
'#include "unlocked-io.h"' does not mean that the program is single-
threaded; it means that no FILE object is being accessed in more than
one thread.
What do you think?
Bruno
next prev parent reply other threads:[~2021-03-03 3:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-03 0:28 [PATCH] mbrtowc: port to AIX 7.1 with xlc 12.1 Paul Eggert
2021-03-03 3:27 ` Bruno Haible [this message]
2021-03-06 16:56 ` single-threaded optimizations Paul Eggert
2021-03-07 9:58 ` Bruno Haible
2021-03-07 10:03 ` Bruno Haible
2021-03-08 2:46 ` Paul Eggert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=14551115.F8Qjx3YMge@omega \
--to=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
--cc=eggert@cs.ucla.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).