]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Presence of pthread_mutex_t::__m_kind or pthread_mutex_t::__data.__kind is now detect...
authorBart Van Assche <bvanassche@acm.org>
Sat, 5 Apr 2008 12:53:15 +0000 (12:53 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sat, 5 Apr 2008 12:53:15 +0000 (12:53 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7846

configure.in
exp-drd/drd_pthread_intercepts.c

index 6ed26fa7d28754ec19db5d5e47df580cf40a7cb9..18274151d47abdd5f322ee84d8823de5c879ee17 100644 (file)
@@ -550,6 +550,50 @@ if test "${no_x}" != 'yes' ; then
 fi
 
 
+# Check whether pthread_mutex_t has a member called __m_kind.
+
+AC_MSG_CHECKING([for pthread_mutex_t::__m_kind])
+
+AC_COMPILE_IFELSE(
+[
+#include <pthread.h> 
+int main(int argc, char** argv)
+{
+  pthread_mutex_t m;
+  return m.__m_kind;
+}
+],
+[
+AC_MSG_RESULT([yes])
+AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], 1,
+          [Define to 1 if pthread_mutex_t has a member called __m_kind.])
+], [
+AC_MSG_RESULT([no])
+])
+
+
+# Check whether pthread_mutex_t has a member called __data.__kind.
+
+AC_MSG_CHECKING([for pthread_mutex_t::__data.__kind])
+
+AC_COMPILE_IFELSE(
+[
+#include <pthread.h> 
+int main(int argc, char** argv)
+{
+  pthread_mutex_t m;
+  return m.__data.__kind;
+}
+],
+[
+AC_MSG_RESULT([yes])
+AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], 1,
+          [Define to 1 if pthread_mutex_t has a member __data.__kind.])
+], [
+AC_MSG_RESULT([no])
+])
+
+
 # does this compiler support -fopenmp, does it have the include file
 # <omp.h> and does it have libgomp ?
 
index 2c1b7734dad920e595390155e65673ca2b80c85a..36793c68120515374fd04345c13e0041acc02704 100644 (file)
@@ -53,6 +53,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>         // confstr()
+#include "config.h"
 #include "drd_clientreq.h"
 #include "pub_tool_redir.h"
 
@@ -120,15 +121,18 @@ static MutexT pthread_to_drd_mutex_type(const int kind)
 
 static MutexT mutex_type(pthread_mutex_t* mutex)
 {
-#if defined(_PTHREAD_DESCR_DEFINED)
-  // Linuxthreads.
+#if defined(HAVE_PTHREAD_MUTEX_T__M_KIND)
+  /* LinuxThreads. */
   const int kind = mutex->__m_kind;
-#elif defined(__SIZEOF_PTHREAD_MUTEX_T)
-  // NPTL.
+#elif defined(HAVE_PTHREAD_MUTEX_T__DATA__KIND)
+  /* NPTL. */
   const int kind = mutex->__data.__kind;
 #else
-  // Another POSIX threads implementation. Regression tests will fail.
+  /* Another POSIX threads implementation. Regression tests will fail. */
   const int kind = PTHREAD_MUTEX_DEFAULT;
+  fprintf(stderr,
+          "Did not recognize your POSIX threads implementation. Giving up.\n");
+  assert(0);
 #endif
   return pthread_to_drd_mutex_type(kind);
 }