Reported by Devin Hussey <husseydevin@gmail.com>.
Based on a patch by Paul Eggert.
* lib/glthread/lock.h (pthread_in_use): Use 'pthread_mutexattr_gettype'
as witness of libpthread.
* lib/glthread/cond.h (pthread_in_use): Likewise.
* lib/glthread/thread.h (pthread_in_use): Likewise.
* lib/glthread/tls.h (pthread_in_use): Likewise.
+2018-05-10 Bruno Haible <bruno@clisp.org>
+
+ lock, cond, thread, tls: Use a different symbol as libpthread witness.
+ Reported by Devin Hussey <husseydevin@gmail.com>.
+ Based on a patch by Paul Eggert.
+ * lib/glthread/lock.h (pthread_in_use): Use 'pthread_mutexattr_gettype'
+ as witness of libpthread.
+ * lib/glthread/cond.h (pthread_in_use): Likewise.
+ * lib/glthread/thread.h (pthread_in_use): Likewise.
+ * lib/glthread/tls.h (pthread_in_use): Likewise.
+
2018-05-10 Bruno Haible <bruno@clisp.org>
cond tests: Fix compilation error on Solaris.
# endif
# if !PTHREAD_IN_USE_DETECTION_HARD
-# pragma weak pthread_cancel
-# define pthread_in_use() (pthread_cancel != NULL)
+# pragma weak pthread_mutexattr_gettype
+# define pthread_in_use() (pthread_mutexattr_gettype != NULL)
# endif
# else
# endif
# if !PTHREAD_IN_USE_DETECTION_HARD
- /* On most platforms, pthread_cancel or pthread_kill can be used to
- determine whether libpthread is in use.
- On newer versions of FreeBSD, however, this is no longer possible,
- because pthread_cancel and pthread_kill got added to libc. Therefore
- use pthread_create to test whether libpthread is in use. */
-# if defined __FreeBSD__ || defined __DragonFly__ /* FreeBSD */
-# pragma weak pthread_create
-# define pthread_in_use() (pthread_create != NULL)
-# else /* glibc, NetBSD, OpenBSD, IRIX, OSF/1, Solaris */
-# pragma weak pthread_cancel
-# define pthread_in_use() (pthread_cancel != NULL)
-# endif
+ /* Considering all platforms with USE_POSIX_THREADS_WEAK, only few symbols
+ can be used to determine whether libpthread is in use. These are:
+ pthread_mutexattr_gettype
+ pthread_rwlockattr_destroy
+ pthread_rwlockattr_init
+ */
+# pragma weak pthread_mutexattr_gettype
+# define pthread_in_use() (pthread_mutexattr_gettype != NULL)
# endif
# else
# endif
# if !PTHREAD_IN_USE_DETECTION_HARD
-# pragma weak pthread_cancel
-# define pthread_in_use() (pthread_cancel != NULL)
+# pragma weak pthread_mutexattr_gettype
+# define pthread_in_use() (pthread_mutexattr_gettype != NULL)
# endif
# else
# endif
# if !PTHREAD_IN_USE_DETECTION_HARD
-# pragma weak pthread_cancel
-# define pthread_in_use() (pthread_cancel != NULL)
+# pragma weak pthread_mutexattr_gettype
+# define pthread_in_use() (pthread_mutexattr_gettype != NULL)
# endif
# else