Discussion:
threadlib: optimize on Solaris 10 or newer
(too old to reply)
Bruno Haible
2016-12-10 13:05:12 UTC
Permalink
Raw Message
It was reported in <https://savannah.gnu.org/bugs/?32087>
that the PTHREAD_IN_USE_DETECTION_HARD setting that causes
a dummy thread to be created at runtime, just to see whether
multithreading is really enabled, is no longer necessary in Solaris 10.

This is true according to the Solaris doc:
https://docs.oracle.com/cd/E19205-01/819-5264/afanb/index.html
https://docs.oracle.com/cd/E18752_01/html/816-5137/compile-94611.html


2016-12-10 Bruno Haible <***@clisp.org>

threadlib: Optimize out runtime test on Solaris >= 10.
* m4/threadlib.m4 (gl_THREADLIB_BODY): Don't set
PTHREAD_IN_USE_DETECTION_HARD if configuring on Solaris 10 or newer.
Reported by Peter Felecan at <https://savannah.gnu.org/bugs/?32087>.

diff --git a/m4/threadlib.m4 b/m4/threadlib.m4
index b43534e..2b6b6cf 100644
--- a/m4/threadlib.m4
+++ b/m4/threadlib.m4
@@ -1,4 +1,4 @@
-# threadlib.m4 serial 11 (gettext-0.18.2)
+# threadlib.m4 serial 12
dnl Copyright (C) 2005-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -195,8 +195,10 @@ int main ()
# Therefore pthread_in_use() needs to actually try to create a
# thread: pthread_create from libc will fail, whereas
# pthread_create will actually create a thread.
+ # On Solaris 10 or newer, this test is no longer needed, because
+ # libc contains the fully functional pthread functions.
case "$host_os" in
- solaris* | hpux*)
+ solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*)
AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1],
[Define if the pthread_in_use() detection is hard.])
esac

Loading...