]> Savannah Git Hosting - gnulib.git/commitdiff
pthread-h: Fix compilation error on mingw with --enable-threads=windows.
authorBruno Haible <bruno@clisp.org>
Mon, 5 Sep 2022 19:54:10 +0000 (21:54 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 10 Sep 2022 01:01:22 +0000 (03:01 +0200)
* lib/pthread.in.h: In C++ mode, if mingw's <pthread.h> has not been
used, import many pthread_* symbols from the GNULIB_NAMESPACE into the
global namespace.

ChangeLog
lib/pthread.in.h

index 3127f529cd56745027f99399e4343c963bedfbc9..4c9405b54cb66bb734857f01acfd923ea3fece12 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-09-05  Bruno Haible  <bruno@clisp.org>
+
+       pthread-h: Fix compilation error on mingw with --enable-threads=windows.
+       * lib/pthread.in.h: In C++ mode, if mingw's <pthread.h> has not been
+       used, import many pthread_* symbols from the GNULIB_NAMESPACE into the
+       global namespace.
+
 2022-09-04  Bruno Haible  <bruno@clisp.org>
 
        Fix various test link errors on MSVC.
index 5a658db9ab6d270ecee5dae40a6bae2d0227358c..cf9ca3a4a59b2af15a76cd04613798887dfc2d1d 100644 (file)
@@ -1968,6 +1968,35 @@ _GL_WARN_ON_USE (pthread_spin_destroy, "pthread_spin_destroy is not portable - "
 #endif
 
 
+#if defined __cplusplus && defined GNULIB_NAMESPACE && !@HAVE_PTHREAD_H@ && defined __MINGW32__
+/* Provide the symbols required by mingw's <bits/gthr-default.h>.  */
+using GNULIB_NAMESPACE::pthread_create;
+using GNULIB_NAMESPACE::pthread_self;
+using GNULIB_NAMESPACE::pthread_equal;
+using GNULIB_NAMESPACE::pthread_detach;
+using GNULIB_NAMESPACE::pthread_join;
+using GNULIB_NAMESPACE::pthread_once;
+using GNULIB_NAMESPACE::pthread_mutex_init;
+using GNULIB_NAMESPACE::pthread_mutexattr_init;
+using GNULIB_NAMESPACE::pthread_mutexattr_settype;
+using GNULIB_NAMESPACE::pthread_mutexattr_destroy;
+using GNULIB_NAMESPACE::pthread_mutex_lock;
+using GNULIB_NAMESPACE::pthread_mutex_trylock;
+using GNULIB_NAMESPACE::pthread_mutex_timedlock;
+using GNULIB_NAMESPACE::pthread_mutex_unlock;
+using GNULIB_NAMESPACE::pthread_mutex_destroy;
+using GNULIB_NAMESPACE::pthread_cond_wait;
+using GNULIB_NAMESPACE::pthread_cond_timedwait;
+using GNULIB_NAMESPACE::pthread_cond_signal;
+using GNULIB_NAMESPACE::pthread_cond_broadcast;
+using GNULIB_NAMESPACE::pthread_cond_destroy;
+using GNULIB_NAMESPACE::pthread_key_create;
+using GNULIB_NAMESPACE::pthread_setspecific;
+using GNULIB_NAMESPACE::pthread_getspecific;
+using GNULIB_NAMESPACE::pthread_key_delete;
+#endif
+
+
 #endif /* _@GUARD_PREFIX@_PTHREAD_H_ */
 #endif /* _@GUARD_PREFIX@_PTHREAD_H_ */
 #endif