1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2025-08-08 17:22:05 +03:00

getusershell: Optimize stdio accesses when possible.

* lib/getusershell.c: Test GNULIB_GETUSERSHELL_SINGLE_THREAD instead of
USE_UNLOCKED_IO.
* modules/getusershell (Depends-on): Add unlocked-io-internal.
* doc/multithread.texi: Document GNULIB_GETUSERSHELL_SINGLE_THREAD.
This commit is contained in:
Bruno Haible
2021-03-07 02:21:49 +01:00
parent 212f0b69ab
commit 92052c4491
4 changed files with 16 additions and 3 deletions

View File

@@ -1,3 +1,11 @@
2021-03-06 Bruno Haible <bruno@clisp.org>
getusershell: Optimize stdio accesses when possible.
* lib/getusershell.c: Test GNULIB_GETUSERSHELL_SINGLE_THREAD instead of
USE_UNLOCKED_IO.
* modules/getusershell (Depends-on): Add unlocked-io-internal.
* doc/multithread.texi: Document GNULIB_GETUSERSHELL_SINGLE_THREAD.
2021-03-06 Bruno Haible <bruno@clisp.org> 2021-03-06 Bruno Haible <bruno@clisp.org>
unlocked-io-internal: New module. unlocked-io-internal: New module.

View File

@@ -274,4 +274,8 @@ You may define the C macro @code{GNULIB_WCHAR_SINGLE}, if all the programs in
your package are single-threaded and won't change the locale after it has your package are single-threaded and won't change the locale after it has
been initialized. This macro optimizes the functions @code{mbrtowc} and been initialized. This macro optimizes the functions @code{mbrtowc} and
@code{wcwidth}. @code{wcwidth}.
@item
You may define the C macro @code{GNULIB_GETUSERSHELL_SINGLE_THREAD}, if all the
programs in your package invoke the functions @code{setusershell},
@code{getusershell}, @code{endusershell} only from a single thread.
@end itemize @end itemize

View File

@@ -39,7 +39,7 @@
#include "stdio--.h" #include "stdio--.h"
#include "xalloc.h" #include "xalloc.h"
#if USE_UNLOCKED_IO #if GNULIB_GETUSERSHELL_SINGLE_THREAD
# include "unlocked-io.h" # include "unlocked-io.h"
#endif #endif

View File

@@ -8,8 +8,9 @@ m4/getusershell.m4
Depends-on: Depends-on:
unistd unistd
extensions extensions
fopen-safer [test $HAVE_GETUSERSHELL = 0] fopen-safer [test $HAVE_GETUSERSHELL = 0]
xalloc [test $HAVE_GETUSERSHELL = 0] unlocked-io-internal [test $HAVE_GETUSERSHELL = 0]
xalloc [test $HAVE_GETUSERSHELL = 0]
configure.ac: configure.ac:
gl_FUNC_GETUSERSHELL gl_FUNC_GETUSERSHELL