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


Reply via email to