]> Savannah Git Hosting - gnulib.git/commitdiff
regex: Allow locking optimization independently of 'unlocked-io'.
authorBruno Haible <bruno@clisp.org>
Sun, 7 Mar 2021 01:47:03 +0000 (02:47 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 7 Mar 2021 10:01:59 +0000 (11:01 +0100)
* lib/regex_internal.h: Test GNULIB_REGEX_SINGLE_THREAD instead of
USE_UNLOCKED_IO.
* doc/multithread.texi: Document GNULIB_REGEX_SINGLE_THREAD.

ChangeLog
doc/multithread.texi
lib/regex_internal.h

index d2ffff05aff36dd10116a00913035b240e4e9883..f9bdb94845043741abc9cb886736a7781b644430 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2021-03-06  Bruno Haible  <bruno@clisp.org>
+
+       regex: Allow locking optimization independently of 'unlocked-io'.
+       * lib/regex_internal.h: Test GNULIB_REGEX_SINGLE_THREAD instead of
+       USE_UNLOCKED_IO.
+       * doc/multithread.texi: Document GNULIB_REGEX_SINGLE_THREAD.
+
 2021-03-06  Bruno Haible  <bruno@clisp.org>
 
        exclude: Allow stdio optimization independently of 'unlocked-io'.
index 082ccb05b51fc0ef9265b0086d3370252c066333..cb0c620ff9ac9f80831d341a3d74832793d842e0 100644 (file)
@@ -270,6 +270,10 @@ You need extra code for this optimization to be effective: include the
 @code{"unlocked-io.h"} header file.  Some Gnulib modules that do operations
 on @code{FILE} streams have these preparations already included.
 @item
+You may define the C macro @code{GNULIB_REGEX_SINGLE_THREAD}, if all the
+programs in your package invoke the functions of the @code{regex} module
+only from a single thread.
+@item
 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
 been initialized.  This macro optimizes the functions @code{mbrtowc} and
index 4b0a3efb6491ec2944a9e980c2dcf31a0bc26b2e..1245e782ffc69086bc4fd28ab4107082695d9b1a 100644 (file)
 # define lock_fini(lock) ((void) 0)
 # define lock_lock(lock) __libc_lock_lock (lock)
 # define lock_unlock(lock) __libc_lock_unlock (lock)
-#elif defined GNULIB_LOCK && !defined USE_UNLOCKED_IO
+#elif defined GNULIB_LOCK && !defined GNULIB_REGEX_SINGLE_THREAD
 # include "glthread/lock.h"
 # define lock_define(name) gl_lock_define (, name)
 # define lock_init(lock) glthread_lock_init (&(lock))
 # define lock_fini(lock) glthread_lock_destroy (&(lock))
 # define lock_lock(lock) glthread_lock_lock (&(lock))
 # define lock_unlock(lock) glthread_lock_unlock (&(lock))
-#elif defined GNULIB_PTHREAD && !defined USE_UNLOCKED_IO
+#elif defined GNULIB_PTHREAD && !defined GNULIB_REGEX_SINGLE_THREAD
 # include <pthread.h>
 # define lock_define(name) pthread_mutex_t name;
 # define lock_init(lock) pthread_mutex_init (&(lock), 0)