bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: no pthread_spinlock_t on Mac OS 10.6.4


From: Paul Eggert
Subject: Re: no pthread_spinlock_t on Mac OS 10.6.4
Date: Sun, 19 Sep 2010 23:21:03 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8

On 09/19/2010 07:43 PM, Gary V. Vaughan wrote:
>  my system headers have no pthread_spinlock_t definition, but
> gnulib sees /usr/include/pthread.h and uses that instead of generating it's 
> own,
> ...
> I don't know enough about pthreads to tell whether gnulib should paper over
> the lack of spinlocks on Mac OS, or whether coreutils should be more careful
> about using spinlocks without having tested for them first...

If MacOS doesn't have spinlocks, then from coreutils' point of view MacOS
doesn't have proper thread support.  The simplest fix is for coreutils
to use the substitute pthread.h on MacOS.  Does the following patch
work for you?

diff --git a/m4/pthread.m4 b/m4/pthread.m4
index 69866cb..121d84d 100644
--- a/m4/pthread.m4
+++ b/m4/pthread.m4
@@ -6,19 +6,22 @@ dnl with or without modifications, as long as this notice is 
preserved.
 
 AC_DEFUN([gl_PTHREAD_CHECK],
   [AC_CHECK_HEADERS_ONCE([pthread.h])
+   AC_CHECK_TYPES([pthread_t])
 
    LIB_PTHREAD=
-   PTHREAD_H=
-   if test "$ac_cv_header_pthread_h" = yes; then
-     gl_saved_libs=$LIBS
-     AC_SEARCH_LIBS([pthread_create], [pthread],
-       [if test "$ac_cv_search_pthread_create" != "none required"; then
-          LIB_PTHREAD="$ac_cv_search_pthread_create"
-        fi])
-     LIBS="$gl_saved_libs"
-   else
-     AC_CHECK_TYPES([pthread_t])
-     PTHREAD_H='pthread.h'
+   PTHREAD_H='pthread.h'
+   if test "$ac_cv_header_pthread_h" = yes &&
+      test "$ac_cv_type_pthread_t" = yes; then
+     AC_CHECK_TYPE([pthread_spinlock_t])
+     if test "$ac_cv_type_pthread_spinlock_t" = yes; then
+       PTHREAD_H=
+       gl_saved_libs=$LIBS
+       AC_SEARCH_LIBS([pthread_create], [pthread],
+         [if test "$ac_cv_search_pthread_create" != "none required"; then
+            LIB_PTHREAD="$ac_cv_search_pthread_create"
+          fi])
+       LIBS="$gl_saved_libs"
+     fi
    fi
 
    AC_SUBST([LIB_PTHREAD])



reply via email to

[Prev in Thread] Current Thread [Next in Thread]