On Sat, Jun 30, 2001 at 02:08:17PM -0700, [EMAIL PROTECTED] wrote:
> Memories of conversations with Manoj.  AIX may have it working, but I
> definately remember that there are platforms with PTHREAD_PROCESS_SHARED
> defined even though it doesn't work.

FWIW, Linux's glibc has this bogus behavior (setpshared would return
ENOSYS in glibc).

Try this patch on for size.  Correctly detects Solaris as being good and
Linux as being bogus.  (And FreeBSD doesn't have threads anyway.)

The only thing I don't like is "int main()", but Solaris refused to
compile it without that since we have -Wall defined.  -- justin

Index: configure.in
===================================================================
RCS file: /home/cvs/apr/configure.in,v
retrieving revision 1.321
diff -u -r1.321 configure.in
--- configure.in        2001/06/28 01:57:02     1.321
+++ configure.in        2001/06/30 21:46:03
@@ -937,6 +937,30 @@
 if test "$threads" = "1"; then
     APR_CHECK_DEFINE(PTHREAD_PROCESS_SHARED, pthread.h)
     AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
+    dnl Some systems have setpshared and define PROCESS_SHARED, but don't 
+    dnl support PROCESS_SHARED locks.  So, we must validate that we can 
+    dnl go through the steps without receiving some sort of system error.
+    APR_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED 
func:pthread_mutexattr_setpshared, 
+    AC_TRY_RUN([
+        #include <sys/types.h>
+        #include <pthread.h>
+        int main()
+        {
+            pthread_mutex_t mutex;
+            pthread_mutexattr_t attr;
+            if (pthread_mutexattr_init(&attr))
+                exit(1);
+            if (pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED))
+                exit(2);
+            if (pthread_mutex_init(&mutex, &attr))
+                exit(3);
+            if (pthread_mutexattr_destroy(&attr))
+                exit(4);
+            if (pthread_mutex_destroy(&mutex))
+                exit(5);
+            exit(0);
+        }], [], [ac_cv_func_pthread_mutexattr_setpshared=no], 
+        [ac_cv_func_pthread_mutexattr_setpshared=no]))
 fi
 
 # See which lock mechanisms we can support on this system.
@@ -955,7 +979,7 @@
 APR_IFALLYES(header:fcntl.h define:F_SETLK,
             APR_DECIDE(USE_FCNTL_SERIALIZE, [SVR4-style fcntl()]))
 APR_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED dnl
-            func:pthread_mutexattr_setpshared custom:with_pthread_cross,
+            func:pthread_mutexattr_setpshared,
             APR_DECIDE(USE_PROC_PTHREAD_SERIALIZE, [pthread mutex]))
 if test "x$apr_lock_method" != "x"; then
     APR_DECISION_FORCE($apr_lock_method)

Reply via email to