From unknown Mon Jun 23 05:57:10 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#7073 <7073@debbugs.gnu.org> To: bug#7073 <7073@debbugs.gnu.org> Subject: Status: no pthread_spinlock_t on Mac OS 10.6.4 Reply-To: bug#7073 <7073@debbugs.gnu.org> Date: Mon, 23 Jun 2025 12:57:10 +0000 retitle 7073 no pthread_spinlock_t on Mac OS 10.6.4 reassign 7073 coreutils submitter 7073 "Gary V. Vaughan" severity 7073 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 20 01:51:04 2010 Received: (at submit) by debbugs.gnu.org; 20 Sep 2010 05:51:04 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxZHM-0000uH-1K for submit@debbugs.gnu.org; Mon, 20 Sep 2010 01:51:04 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxWJv-0007wq-Fu for submit@debbugs.gnu.org; Sun, 19 Sep 2010 22:41:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OxWMI-0003SU-Rw for submit@debbugs.gnu.org; Sun, 19 Sep 2010 22:44:00 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:54271) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxWMI-0003SQ-PT for submit@debbugs.gnu.org; Sun, 19 Sep 2010 22:43:58 -0400 Received: from [140.186.70.92] (port=45188 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OxWMG-0002DW-NZ for bug-coreutils@gnu.org; Sun, 19 Sep 2010 22:43:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OxWMF-0003Rs-AQ for bug-coreutils@gnu.org; Sun, 19 Sep 2010 22:43:56 -0400 Received: from caiajhbdcbbj.dreamhost.com ([208.97.132.119]:45996 helo=homiemail-a21.g.dreamhost.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxWME-0003Rl-Vr; Sun, 19 Sep 2010 22:43:55 -0400 Received: from homiemail-a21.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a21.g.dreamhost.com (Postfix) with ESMTP id 1F577300064; Sun, 19 Sep 2010 19:43:54 -0700 (PDT) Received: from [192.168.1.3] (unknown [110.164.166.160]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: gary@vaughan.pe) by homiemail-a21.g.dreamhost.com (Postfix) with ESMTPSA id 11283300059; Sun, 19 Sep 2010 19:43:52 -0700 (PDT) From: "Gary V. Vaughan" Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Apple-Mail-10--446737981" Content-Transfer-Encoding: 7bit Subject: no pthread_spinlock_t on Mac OS 10.6.4 Date: Mon, 20 Sep 2010 09:43:43 +0700 Message-Id: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> To: bug-coreutils@gnu.org Mime-Version: 1.0 (Apple Message framework v1081) X-Pgp-Agent: GPGMail 1.3.0 X-Mailer: Apple Mail (2.1081) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 20 Sep 2010 01:51:02 -0400 Cc: bug-gnulib List X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.4 (-----) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --Apple-Mail-10--446737981 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii While testing my rewrite of gnulib's bootstrap script, I've been unable to rebuild coreutils from git master. However, when I reverted to a fresh checkout and used the repo bootstrap script, the build still fails on my Mac: ../../src/sort.c:243: error: expected specifier-qualifier-list before = 'pthread_spinlock_t' ../../src/sort.c: In function 'lock_node': ../../src/sort.c:3159: warning: implicit declaration of function = 'pthread_spin_lock' ../../src/sort.c:3159: error: 'struct merge_node' has no member named = 'lock' ../../src/sort.c: In function 'unlock_node': ../../src/sort.c:3167: warning: implicit declaration of function = 'pthread_spin_unlock' ../../src/sort.c:3167: error: 'struct merge_node' has no member named = 'lock' ../../src/sort.c: In function 'sortlines': ../../src/sort.c:3445: error: 'pthread_spinlock_t' undeclared (first use = in this function) ../../src/sort.c:3445: error: (Each undeclared identifier is reported = only once ../../src/sort.c:3445: error: for each function it appears in.) ../../src/sort.c:3445: error: expected ';' before 'lock' ../../src/sort.c:3446: warning: implicit declaration of function = 'pthread_spin_init' ../../src/sort.c:3446: error: 'lock' undeclared (first use in this = function) ../../src/sort.c:3448: warning: excess elements in struct initializer ../../src/sort.c:3448: warning: (near initialization for 'node') ../../src/sort.c: In function 'sort': ../../src/sort.c:3759: error: 'pthread_spinlock_t' undeclared (first use = in this function) ../../src/sort.c:3759: error: expected ';' before 'lock' ../../src/sort.c:3760: error: 'lock' undeclared (first use in this = function) ../../src/sort.c:3763: warning: excess elements in struct initializer ../../src/sort.c:3763: warning: (near initialization for 'node') lib/config.h contains: /* Define to 1 if you have the `pthread_atfork' function. */ #define HAVE_PTHREAD_ATFORK 1 /* Define to 1 if you have the header file. */ #define HAVE_PTHREAD_H 1 /* Define if the defines PTHREAD_MUTEX_RECURSIVE. */ #define HAVE_PTHREAD_MUTEX_RECURSIVE 1 /* Define if the POSIX multithreading library has read/write locks. */ #define HAVE_PTHREAD_RWLOCK 1 /* Define to 1 if the system has the type `pthread_t'. */ /* #undef HAVE_PTHREAD_T */ So, in this case, 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, even though gnulib's pthread.h makes no allowance for lack of spinlocks = when HAVE_PTHREAD_T is undefined as in my case. 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... Cheers, --=20 Gary V. Vaughan (gary@gnu.org)= --Apple-Mail-10--446737981 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) iEYEARECAAYFAkyWymEACgkQFRMICSmD1gbK6wCfd8/WDDKXzvF7UmfXqlc23rxq Pu8An3MPDkCvCncNnWrCxxicQRc8M7zX =UjH0 -----END PGP SIGNATURE----- --Apple-Mail-10--446737981-- From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 20 02:19:04 2010 Received: (at submit) by debbugs.gnu.org; 20 Sep 2010 06:19:04 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxZiR-00015T-QR for submit@debbugs.gnu.org; Mon, 20 Sep 2010 02:19:04 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxZiP-000157-Fv for submit@debbugs.gnu.org; Mon, 20 Sep 2010 02:19:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OxZkn-0000fr-Ee for submit@debbugs.gnu.org; Mon, 20 Sep 2010 02:21:30 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:34223) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxZkn-0000fg-CD for submit@debbugs.gnu.org; Mon, 20 Sep 2010 02:21:29 -0400 Received: from [140.186.70.92] (port=57040 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OxZkl-0003tE-EO for bug-coreutils@gnu.org; Mon, 20 Sep 2010 02:21:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OxZkj-0000fG-7n for bug-coreutils@gnu.org; Mon, 20 Sep 2010 02:21:27 -0400 Received: from vms173011pub.verizon.net ([206.46.173.11]:52440) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxZkj-0000f8-3Q; Mon, 20 Sep 2010 02:21:25 -0400 Received: from [192.168.1.10] ([unknown] [71.189.109.235]) by vms173011.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0L9100LSP8B3YBVD@vms173011.mailsrvcs.net>; Mon, 20 Sep 2010 01:21:14 -0500 (CDT) Message-id: <4C96FD4F.9060308@cs.ucla.edu> Date: Sun, 19 Sep 2010 23:21:03 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 MIME-version: 1.0 To: "Gary V. Vaughan" Subject: Re: no pthread_spinlock_t on Mac OS 10.6.4 References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> In-reply-to: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Solaris 10 (1203?) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.3 (----) X-Debbugs-Envelope-To: submit Cc: bug-gnulib List , bug-coreutils@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.3 (----) 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]) From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 20 03:12:35 2010 Received: (at submit) by debbugs.gnu.org; 20 Sep 2010 07:12:35 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxaYE-0001RN-L2 for submit@debbugs.gnu.org; Mon, 20 Sep 2010 03:12:35 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxaYC-0001R6-OQ for submit@debbugs.gnu.org; Mon, 20 Sep 2010 03:12:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oxaaa-0006kE-2Y for submit@debbugs.gnu.org; Mon, 20 Sep 2010 03:15:01 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:42290) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxaaZ-0006ja-Ix for submit@debbugs.gnu.org; Mon, 20 Sep 2010 03:15:00 -0400 Received: from [140.186.70.92] (port=40889 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OxaaX-0005MU-Sq for bug-coreutils@gnu.org; Mon, 20 Sep 2010 03:14:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OxaaW-0006ij-3P for bug-coreutils@gnu.org; Mon, 20 Sep 2010 03:14:57 -0400 Received: from caiajhbdcbef.dreamhost.com ([208.97.132.145]:58713 helo=homiemail-a20.g.dreamhost.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxaaV-0006ib-P4; Mon, 20 Sep 2010 03:14:56 -0400 Received: from homiemail-a20.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a20.g.dreamhost.com (Postfix) with ESMTP id 927E27EC069; Mon, 20 Sep 2010 00:14:55 -0700 (PDT) Received: from [192.168.1.3] (unknown [110.164.166.160]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: gary@vaughan.pe) by homiemail-a20.g.dreamhost.com (Postfix) with ESMTPSA id B03847EC061; Mon, 20 Sep 2010 00:14:53 -0700 (PDT) Subject: Re: no pthread_spinlock_t on Mac OS 10.6.4 Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Apple-Mail-11--430475018" From: "Gary V. Vaughan" In-Reply-To: <4C96FD4F.9060308@cs.ucla.edu> Date: Mon, 20 Sep 2010 14:14:46 +0700 Content-Transfer-Encoding: 7bit Message-Id: References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <4C96FD4F.9060308@cs.ucla.edu> To: Paul Eggert , 7073@debbugs.gnu.org X-Pgp-Agent: GPGMail 1.3.0 X-Mailer: Apple Mail (2.1081) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.1 (-----) X-Debbugs-Envelope-To: submit Cc: bug-gnulib List , bug-coreutils@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.4 (-----) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --Apple-Mail-11--430475018 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi Paul, Thanks for looking at this. On 20 Sep 2010, at 13:21, Paul Eggert wrote: > 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... >=20 > 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? It fixes the original spinlocks error I reported, but then the build = falls over on lib/glthread/lock.c: In file included from ../../lib/glthread/lock.h:93, from ../../lib/glthread/lock.c:26: ./pthread.h:184: error: expected ')' before '*' token ./pthread.h:191: error: expected ')' before '*' token ./pthread.h:198: error: expected ')' before '*' token ./pthread.h:206: error: expected ')' before '*' token ../../lib/glthread/lock.c: In function = 'glthread_recursive_lock_init_multithreaded': ../../lib/glthread/lock.c:321: warning: implicit declaration of function = 'pthread_mutexattr_init' ../../lib/glthread/lock.c:324: warning: implicit declaration of function = 'pthread_mutexattr_settype' ../../lib/glthread/lock.c:327: warning: implicit declaration of function = 'pthread_mutexattr_destroy' where lines 184, 191, 198 and 206 of lib/pthread.h each contain a use of = pthread_spinlock_t. lib/pthread.h does have a typedef for pthread_spinlock_t, but it is = predicated on not having HAVE_PTHREAD_T defined (which I do): ; sed -n /HAVE_PTHREAD_T/,/endif/p lib/pthread.h=20 #ifndef HAVE_PTHREAD_T typedef int pthread_t; typedef int pthread_attr_t; typedef int pthread_barrier_t; typedef int pthread_barrierattr_t; typedef int pthread_cond_t; typedef int pthread_condattr_t; typedef int pthread_key_t; typedef int pthread_mutex_t; typedef int pthread_mutexattr_t; typedef int pthread_once_t; typedef int pthread_rwlock_t; typedef int pthread_rwlockattr_t; typedef int pthread_spinlock_t; #endif ; grep HAVE_PTHREAD_T lib/config.h #define HAVE_PTHREAD_T 1 > 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. >=20 > AC_DEFUN([gl_PTHREAD_CHECK], > [AC_CHECK_HEADERS_ONCE([pthread.h]) > + AC_CHECK_TYPES([pthread_t]) >=20 > LIB_PTHREAD=3D > - PTHREAD_H=3D > - if test "$ac_cv_header_pthread_h" =3D yes; then > - gl_saved_libs=3D$LIBS > - AC_SEARCH_LIBS([pthread_create], [pthread], > - [if test "$ac_cv_search_pthread_create" !=3D "none required"; = then > - LIB_PTHREAD=3D"$ac_cv_search_pthread_create" > - fi]) > - LIBS=3D"$gl_saved_libs" > - else > - AC_CHECK_TYPES([pthread_t]) > - PTHREAD_H=3D'pthread.h' > + PTHREAD_H=3D'pthread.h' > + if test "$ac_cv_header_pthread_h" =3D yes && > + test "$ac_cv_type_pthread_t" =3D yes; then > + AC_CHECK_TYPE([pthread_spinlock_t]) > + if test "$ac_cv_type_pthread_spinlock_t" =3D yes; then > + PTHREAD_H=3D > + gl_saved_libs=3D$LIBS > + AC_SEARCH_LIBS([pthread_create], [pthread], > + [if test "$ac_cv_search_pthread_create" !=3D "none = required"; then > + LIB_PTHREAD=3D"$ac_cv_search_pthread_create" > + fi]) > + LIBS=3D"$gl_saved_libs" > + fi > fi >=20 > AC_SUBST([LIB_PTHREAD]) Cheers, --=20 Gary V. Vaughan (gary@gnu.org)= --Apple-Mail-11--430475018 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) iEYEARECAAYFAkyXCeYACgkQFRMICSmD1gaCYgCdHFkRJPenSqzz63ypOfllhV/G /V0An2gkRA9SuG2okWPDOHINUCRM8lix =qiZj -----END PGP SIGNATURE----- --Apple-Mail-11--430475018-- From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 20 05:23:18 2010 Received: (at submit) by debbugs.gnu.org; 20 Sep 2010 09:23:18 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oxcaj-0002Gv-UL for submit@debbugs.gnu.org; Mon, 20 Sep 2010 05:23:18 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oxcah-0002Gq-8p for submit@debbugs.gnu.org; Mon, 20 Sep 2010 05:23:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oxcd5-0000La-PR for submit@debbugs.gnu.org; Mon, 20 Sep 2010 05:25:44 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:38568) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oxcd4-0000L2-AQ for submit@debbugs.gnu.org; Mon, 20 Sep 2010 05:25:43 -0400 Received: from [140.186.70.92] (port=60868 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oxcco-0001mE-BF for bug-coreutils@gnu.org; Mon, 20 Sep 2010 05:25:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oxcck-0000IM-99 for bug-coreutils@gnu.org; Mon, 20 Sep 2010 05:25:23 -0400 Received: from mo-p00-ob.rzone.de ([81.169.146.160]:54344) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxccS-0000Fa-Uc; Mon, 20 Sep 2010 05:25:05 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1284974702; l=599; s=domk; d=haible.de; h=Content-Transfer-Encoding:Content-Type:MIME-Version:In-Reply-To: References:Cc:Date:Subject:To:From:X-RZG-CLASS-ID:X-RZG-AUTH; bh=elvP9+q/HdjnOL2OOuU5mezsdIk=; b=nYQTXt+3AX3ZeaPG04dThcFfIYjim45MNGiCPlHIVDQ1jMMe8ycAtkMoqzkl2lxKKrI WrRgmpzLa+Zh69tGX1cXNfp2spA4882ipamZrddNRFWKAZvGEz8EwCxpOyeW3KYTStuIf 1KqI5E8FenN1MN0OERTCNU/v0AMrnWzyyDE= X-RZG-AUTH: :Ln4Re0+Ic/6oZXR1YgKryK8brksyK8dozXDwHXjf9hj/zDJRaPAi/IaFpUs= X-RZG-CLASS-ID: mo00 Received: from linuix.haible.de (dslb-088-069-164-180.pools.arcor-ip.net [88.69.164.180]) by post.strato.de (fruni mo51) (RZmta 23.5) with ESMTP id a01a82m8K9MDXq ; Mon, 20 Sep 2010 11:24:58 +0200 (MEST) From: Bruno Haible To: bug-gnulib@gnu.org Subject: Re: no pthread_spinlock_t on Mac OS 10.6.4 Date: Mon, 20 Sep 2010 11:24:55 +0200 User-Agent: KMail/1.9.9 References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <4C96FD4F.9060308@cs.ucla.edu> In-Reply-To: <4C96FD4F.9060308@cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201009201124.57544.bruno@clisp.org> X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: submit Cc: Paul Eggert , bug-coreutils@gnu.org, "Gary V. Vaughan" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.6 (------) Hi Paul, > If MacOS doesn't have spinlocks, then from coreutils' point of view MacOS > doesn't have proper thread support. Usually in applications mutexes are used, not spinlocks. The comments in sort.c say: "Note spin locks were seen to perform better than mutexes as long as the number of threads is limited to the number of processors." In other words, spinlocks were chosen instead of mutexes only for performance reasons. So, instead of turning off the entire thread-based parallelization on MacOS X, why not use mutexes instead of spinlocks on this platform? Bruno From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 20 05:32:01 2010 Received: (at submit) by debbugs.gnu.org; 20 Sep 2010 09:32:01 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxcjB-0002KG-91 for submit@debbugs.gnu.org; Mon, 20 Sep 2010 05:32:01 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oxcj8-0002KB-V4 for submit@debbugs.gnu.org; Mon, 20 Sep 2010 05:31:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OxclX-0001cQ-Gw for submit@debbugs.gnu.org; Mon, 20 Sep 2010 05:34:28 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:49667) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxclX-0001cL-Et for submit@debbugs.gnu.org; Mon, 20 Sep 2010 05:34:27 -0400 Received: from [140.186.70.92] (port=40008 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OxclV-0004qE-UU for bug-coreutils@gnu.org; Mon, 20 Sep 2010 05:34:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OxclU-0001bA-KU for bug-coreutils@gnu.org; Mon, 20 Sep 2010 05:34:25 -0400 Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]:7532) by eggs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OxclU-0001aZ-B4 for bug-coreutils@gnu.org; Mon, 20 Sep 2010 05:34:24 -0400 Received: (qmail 17052 invoked from network); 20 Sep 2010 09:34:22 -0000 Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218) by mail1.slb.deg.dub.stisp.net with SMTP; 20 Sep 2010 09:34:22 -0000 Message-ID: <4C972A6E.2010905@draigBrady.com> Date: Mon, 20 Sep 2010 10:33:34 +0100 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: Paul Eggert Subject: Re: bug#7073: no pthread_spinlock_t on Mac OS 10.6.4 References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <4C96FD4F.9060308@cs.ucla.edu> In-Reply-To: <4C96FD4F.9060308@cs.ucla.edu> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: FreeBSD 4.6-4.9 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.7 (----) X-Debbugs-Envelope-To: submit Cc: Chen Guo , bug-gnulib List , bug-coreutils@gnu.org, "Gary V. Vaughan" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.7 (----) On 20/09/10 07:21, Paul Eggert wrote: > 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? On a related note, I've been meaning to check if mutexes in coreutils/sort are more stable and/or fair to the system than spinlocks. If we don't end up moving to mutexes everywhere, perhaps we should do it for Mac OS always? Also on the same point of more appropriate use of system resources, perhaps we should cap the number of cores used to perhaps 8 given results like: http://debbugs.gnu.org/cgi/bugreport.cgi?msg=49;filename=sort-amd-24way.png;att=1;bug=6600 We would allow increasing up to the number of cores available on the system by user specified values (which currently only support decreasing from #cores). cheers, Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 20 13:27:54 2010 Received: (at 7073) by debbugs.gnu.org; 20 Sep 2010 17:27:54 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oxk9g-00069r-7n for submit@debbugs.gnu.org; Mon, 20 Sep 2010 13:27:54 -0400 Received: from kiwi.cs.ucla.edu ([131.179.128.19]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oxk9d-00069k-3E for 7073@debbugs.gnu.org; Mon, 20 Sep 2010 13:27:50 -0400 Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id o8KHUHZr020836; Mon, 20 Sep 2010 10:30:18 -0700 (PDT) Message-ID: <4C979A29.4010805@cs.ucla.edu> Date: Mon, 20 Sep 2010 10:30:17 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 MIME-Version: 1.0 To: "Gary V. Vaughan" Subject: Re: no pthread_spinlock_t on Mac OS 10.6.4 References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <4C96FD4F.9060308@cs.ucla.edu> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -3.4 (---) X-Debbugs-Envelope-To: 7073 Cc: bug-gnulib List , bug-coreutils@gnu.org, 7073@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.4 (---) On 09/20/10 00:14, Gary V. Vaughan wrote: > lib/pthread.h does have a typedef for pthread_spinlock_t, but it is predicated on not having HAVE_PTHREAD_T defined (which I do): Ah, OK. Could you try the following patch instead? If you have a similar problem with (say) pthread_rwlockattr_t, you can treat it just like pthread_spinlock_t in lib/pthread.in.h and m4/pthread.m4; please just let us know which types those are. I'd rather not add compile-time checks for each dinky little pthread type unless it's known to be needed, as 'configure' takes too long already. diff --git a/lib/pthread.in.h b/lib/pthread.in.h index 4dad22a..84cf913 100644 --- a/lib/pthread.in.h +++ b/lib/pthread.in.h @@ -40,6 +40,8 @@ typedef int pthread_once_t; typedef int pthread_rwlock_t; typedef int pthread_rwlockattr_t; +#endif +#ifndef HAVE_PTHREAD_SPINLOCK_T typedef int pthread_spinlock_t; #endif diff --git a/m4/pthread.m4 b/m4/pthread.m4 index 69866cb..a2781eb 100644 --- a/m4/pthread.m4 +++ b/m4/pthread.m4 @@ -6,19 +6,21 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_PTHREAD_CHECK], [AC_CHECK_HEADERS_ONCE([pthread.h]) + gl_keep_pthread_h=$ac_cv_header_pthread_h + AC_CHECK_TYPES([pthread_t, pthread_spinlock_t], + [], + [gl_keep_pthread_h=no]) + PTHREAD_H='pthread.h' LIB_PTHREAD= - PTHREAD_H= - if test "$ac_cv_header_pthread_h" = yes; then + if test "$gl_keep_pthread_h" = 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" - else - AC_CHECK_TYPES([pthread_t]) - PTHREAD_H='pthread.h' fi AC_SUBST([LIB_PTHREAD]) From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 20 13:30:14 2010 Received: (at submit) by debbugs.gnu.org; 20 Sep 2010 17:30:14 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxkBy-0006BY-9Z for submit@debbugs.gnu.org; Mon, 20 Sep 2010 13:30:14 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxkBw-0006BS-EF for submit@debbugs.gnu.org; Mon, 20 Sep 2010 13:30:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OxkEI-0007nU-GU for submit@debbugs.gnu.org; Mon, 20 Sep 2010 13:32:43 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:52420) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxkEI-0007nN-B6 for submit@debbugs.gnu.org; Mon, 20 Sep 2010 13:32:38 -0400 Received: from [140.186.70.92] (port=43044 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OxkEG-0006sZ-Va for bug-coreutils@gnu.org; Mon, 20 Sep 2010 13:32:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OxkEC-0007mj-Va for bug-coreutils@gnu.org; Mon, 20 Sep 2010 13:32:37 -0400 Received: from kiwi.cs.ucla.edu ([131.179.128.19]:48287) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxkEC-0007mY-Gr; Mon, 20 Sep 2010 13:32:32 -0400 Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id o8KHWSrQ021099; Mon, 20 Sep 2010 10:32:29 -0700 (PDT) Message-ID: <4C979AAB.5070403@cs.ucla.edu> Date: Mon, 20 Sep 2010 10:32:27 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 MIME-Version: 1.0 To: Bruno Haible Subject: Re: no pthread_spinlock_t on Mac OS 10.6.4 References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <4C96FD4F.9060308@cs.ucla.edu> <201009201124.57544.bruno@clisp.org> In-Reply-To: <201009201124.57544.bruno@clisp.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.1 (-----) X-Debbugs-Envelope-To: submit Cc: bug-coreutils@gnu.org, bug-gnulib@gnu.org, Chen Guo , "Gary V. Vaughan" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.1 (-----) On 09/20/10 02:24, Bruno Haible wrote: > why not use mutexes instead of spinlocks on this platform? That might be a good thing to try, though it'd take more work. Chen, what do you think? Here's the email that started this discussion: http://lists.gnu.org/archive/html/bug-coreutils/2010-09/msg00065.html From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 20 13:58:29 2010 Received: (at submit) by debbugs.gnu.org; 20 Sep 2010 17:58:29 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxkdI-0006NH-Op for submit@debbugs.gnu.org; Mon, 20 Sep 2010 13:58:29 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxkdG-0006NB-Hp for submit@debbugs.gnu.org; Mon, 20 Sep 2010 13:58:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oxkff-0004LR-LG for submit@debbugs.gnu.org; Mon, 20 Sep 2010 14:00:56 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:49924) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oxkff-0004LN-HU for submit@debbugs.gnu.org; Mon, 20 Sep 2010 14:00:55 -0400 Received: from [140.186.70.92] (port=52990 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oxkfa-0005Zy-KS for bug-coreutils@gnu.org; Mon, 20 Sep 2010 14:00:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OxkfY-0004K8-W4 for bug-coreutils@gnu.org; Mon, 20 Sep 2010 14:00:50 -0400 Received: from kiwi.cs.ucla.edu ([131.179.128.19]:48512) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxkfP-0004IS-WE; Mon, 20 Sep 2010 14:00:40 -0400 Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id o8KI0XwD021485; Mon, 20 Sep 2010 11:00:34 -0700 (PDT) Message-ID: <4C97A141.9060207@cs.ucla.edu> Date: Mon, 20 Sep 2010 11:00:33 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 MIME-Version: 1.0 To: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= Subject: Re: bug#7073: no pthread_spinlock_t on Mac OS 10.6.4 References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <4C96FD4F.9060308@cs.ucla.edu> <4C972A6E.2010905@draigBrady.com> In-Reply-To: <4C972A6E.2010905@draigBrady.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by kiwi.cs.ucla.edu id o8KI0XwD021485 X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.1 (-----) X-Debbugs-Envelope-To: submit Cc: Chen Guo , bug-gnulib List , bug-coreutils@gnu.org, "Gary V. Vaughan" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.1 (-----) On 09/20/10 02:33, P=C3=A1draig Brady wrote: > On a related note, I've been meaning to check > if mutexes in coreutils/sort are more stable > and/or fair to the system than spinlocks. They ought to be fairer, though I'd expect there to be a significant performance price in some cases. I'm not sure what you mean by "stable" (surely this has nothing to do with stable sorting :-). It's a bit tricky, as some users prefer performance, others fairness, and the default can't satisfy everybody. > perhaps we should cap the > number of cores used to perhaps 8 given results like: > http://debbugs.gnu.org/cgi/bugreport.cgi?msg=3D49;filename=3Dsort-amd-2= 4way.png;att=3D1;bug=3D6600 > We would allow increasing up to the number of cores > available on the system by user specified values > (which currently only support decreasing from #cores). That result depends on the particular benchmark and platform, of course. Still, it might make sense to default to at most 8 for now, as you suggest; the documentation should say that that default might change of course. Another thought: the syntax for --parallel might be generalized to allow for fancier heuristics, e.g.: --parallel=3D50% would mean to use at most half the processors. This particular syntax would be similar to how --buffer-size acts. From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 20 17:35:55 2010 Received: (at submit) by debbugs.gnu.org; 20 Sep 2010 21:35:55 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oxo1i-0000Rz-4f for submit@debbugs.gnu.org; Mon, 20 Sep 2010 17:35:54 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oxo1g-0000Ru-5Z for submit@debbugs.gnu.org; Mon, 20 Sep 2010 17:35:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oxo45-0002rr-7q for submit@debbugs.gnu.org; Mon, 20 Sep 2010 17:38:22 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:58192) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oxo45-0002rm-33 for submit@debbugs.gnu.org; Mon, 20 Sep 2010 17:38:21 -0400 Received: from [140.186.70.92] (port=40420 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oxo43-0005oM-8a for bug-coreutils@gnu.org; Mon, 20 Sep 2010 17:38:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oxo42-0002qs-A4 for bug-coreutils@gnu.org; Mon, 20 Sep 2010 17:38:19 -0400 Received: from mail-ww0-f41.google.com ([74.125.82.41]:53829) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oxo3x-0002ou-ML; Mon, 20 Sep 2010 17:38:13 -0400 Received: by wwi17 with SMTP id 17so554941wwi.0 for ; Mon, 20 Sep 2010 14:38:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=6DQXYl5TKPxGep7/d/clXSJPD6Sxyef6vISaR2R3DfY=; b=XmYw0Tj+t7h2lNxicjWSmYiDkmc3Zpfq75gOxTTw5suVCQljj5zjNTUlQy8OkbK1UC eWkOcWJ+1JUiykQ9Gjw3BbXrBR7qLI9rCmv0SYumGIMQld/orRUBxXiiF1/Ph9i5PRUY emkZLd4E2ToBN8nrNiKgEor+9MY1POPeWdmqA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=kNjRj07l1LI3KipYTw8K2w9XHI+35EKCUFFPMfUS8x8ZqlSREfeHMuHzLH3aJ/lnKf XeZrwx8Nn3j2FT4N+9nN8dg117FT2z55Yy6Ydg/K/3PdLHxJgR2fsx3uMO0YsNlmWZNg ZUinqa8vW9muP5xw1/5o1nP4Y0BUjzv0jetRA= MIME-Version: 1.0 Received: by 10.216.235.104 with SMTP id t82mr4849624weq.103.1285018692180; Mon, 20 Sep 2010 14:38:12 -0700 (PDT) Received: by 10.216.50.212 with HTTP; Mon, 20 Sep 2010 14:38:12 -0700 (PDT) In-Reply-To: <4C97A141.9060207@cs.ucla.edu> References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <4C96FD4F.9060308@cs.ucla.edu> <4C972A6E.2010905@draigBrady.com> <4C97A141.9060207@cs.ucla.edu> Date: Mon, 20 Sep 2010 14:38:12 -0700 Message-ID: Subject: Re: bug#7073: no pthread_spinlock_t on Mac OS 10.6.4 From: Chen Guo To: Paul Eggert Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.8 (----) X-Debbugs-Envelope-To: submit Cc: bug-coreutils@gnu.org, bug-gnulib List , =?ISO-8859-1?Q?P=E1draig_Brady?= , "Gary V. Vaughan" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.0 (-----) Hi all, First regarding mutexes on Macs, I suppose a performance hit with mutexes b= eats no performance at all with missing spinlocks. And regarding "take more work= ," I believe spinlocks and mutexes were basically interchangeable in terms of functionality in our sort algorithm; the work probably will be little more than a few #ifdefs and a s/pthread_mutex_t/pthread_spinlock_t/ How difficult would it be to implement a basic spinlock in gnulib, though? Perhaps we can implement that and fall back to it on MacOS X? >> On a related note, I've been meaning to check >> if mutexes in coreutils/sort are more stable >> and/or fair to the system than spinlocks. > > They ought to be fairer, though I'd expect there to be a significant > performance price in some cases. =A0I'm not sure what you mean > by "stable" (surely this has nothing to do with stable sorting :-). > An example of the stability issues is be the hyperthreaded processor issue. For example, when I was sorting on an i7 (4 cores, 8 logical), sort time wi= th threads > 4 had very high variance with spinlocks, but not with mutexes. I do believe this particular issue is handled; I remember capping threads to the number of physical cores on the system. Of course, there might be other nasties that we just don't know about yet with spinlocks. >> perhaps we should cap the >> number of cores used to perhaps 8 given results like: >> http://debbugs.gnu.org/cgi/bugreport.cgi?msg=3D49;filename=3Dsort-amd-24= way.png;att=3D1;bug=3D6600 >> We would allow increasing up to the number of cores >> available on the system by user specified values >> (which currently only support decreasing from #cores). > > That result depends on the particular benchmark and platform, > of course. =A0Still, it might make sense to default to at most 8 > for now, as you suggest; the documentation should say that that > default might change of course. > This is a good idea... I'm not sure how feasible this would be, but perhaps we can benchmark some common server systems or some performance outliers and define a custom max for these. From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 20 19:35:54 2010 Received: (at submit) by debbugs.gnu.org; 20 Sep 2010 23:35:54 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oxptp-0001Ho-2v for submit@debbugs.gnu.org; Mon, 20 Sep 2010 19:35:53 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oxptn-0001Hj-Gs for submit@debbugs.gnu.org; Mon, 20 Sep 2010 19:35:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OxpwD-0003IX-8T for submit@debbugs.gnu.org; Mon, 20 Sep 2010 19:38:22 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:54211) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxpwD-0003IM-55 for submit@debbugs.gnu.org; Mon, 20 Sep 2010 19:38:21 -0400 Received: from [140.186.70.92] (port=32787 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OxpwB-0007P3-D6 for bug-coreutils@gnu.org; Mon, 20 Sep 2010 19:38:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oxpw9-0003Hz-Mq for bug-coreutils@gnu.org; Mon, 20 Sep 2010 19:38:18 -0400 Received: from kiwi.cs.ucla.edu ([131.179.128.19]:50565) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oxpw6-0003HK-GH; Mon, 20 Sep 2010 19:38:14 -0400 Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id o8KNc8CW025605; Mon, 20 Sep 2010 16:38:08 -0700 (PDT) Message-ID: <4C97F05F.60402@cs.ucla.edu> Date: Mon, 20 Sep 2010 16:38:07 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 MIME-Version: 1.0 To: Chen Guo Subject: Re: bug#7073: no pthread_spinlock_t on Mac OS 10.6.4 References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <4C96FD4F.9060308@cs.ucla.edu> <4C972A6E.2010905@draigBrady.com> <4C97A141.9060207@cs.ucla.edu> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.1 (-----) X-Debbugs-Envelope-To: submit Cc: bug-coreutils@gnu.org, bug-gnulib List , =?ISO-8859-1?Q?P=E1draig_Brady?= , "Gary V. Vaughan" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.1 (-----) On 09/20/10 14:38, Chen Guo wrote: > How difficult would it be to implement a basic spinlock in gnulib, though? Portably? I'd think it'd be quite a pain, as it would require figuring out this platform's atomic instructions, dealing with memory barriers, and the like. > I suppose a performance hit with mutexes beats no performance at all > with missing spinlocks. Yes. > And regarding "take more work," I believe spinlocks and mutexes were > basically interchangeable in terms of functionality in our sort > algorithm; the work probably will be little more than a few #ifdefs > and a s/pthread_mutex_t/pthread_spinlock_t/ Is that a reasonably-valid replacement in general, for code that uses spin locks? If so, we should implement this inside gnulib's pthread module. If not, it needs to be done inside coreutils, or perhaps as a separate gnulib module. From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 20 20:41:33 2010 Received: (at 7073) by debbugs.gnu.org; 21 Sep 2010 00:41:33 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxqvN-0001iq-4s for submit@debbugs.gnu.org; Mon, 20 Sep 2010 20:41:33 -0400 Received: from caiajhbdccac.dreamhost.com ([208.97.132.202] helo=homiemail-a20.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxqvK-0001il-G1 for 7073@debbugs.gnu.org; Mon, 20 Sep 2010 20:41:31 -0400 Received: from homiemail-a20.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a20.g.dreamhost.com (Postfix) with ESMTP id 4F65E7EC063; Mon, 20 Sep 2010 17:44:01 -0700 (PDT) Received: from [192.168.1.3] (unknown [110.164.166.160]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: gary@vaughan.pe) by homiemail-a20.g.dreamhost.com (Postfix) with ESMTPSA id 253AA7EC061; Mon, 20 Sep 2010 17:43:58 -0700 (PDT) Subject: Re: no pthread_spinlock_t on Mac OS 10.6.4 Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Apple-Mail-13--367529134" From: "Gary V. Vaughan" In-Reply-To: <4C979A29.4010805@cs.ucla.edu> Date: Tue, 21 Sep 2010 07:43:52 +0700 Content-Transfer-Encoding: 7bit Message-Id: References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <4C96FD4F.9060308@cs.ucla.edu> <4C979A29.4010805@cs.ucla.edu> To: Paul Eggert X-Pgp-Agent: GPGMail 1.3.0 X-Mailer: Apple Mail (2.1081) X-Spam-Score: -3.3 (---) X-Debbugs-Envelope-To: 7073 Cc: bug-gnulib List , bug-coreutils@gnu.org, 7073@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.1 (---) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --Apple-Mail-13--367529134 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi Paul, On 21 Sep 2010, at 00:30, Paul Eggert wrote: > On 09/20/10 00:14, Gary V. Vaughan wrote: >=20 >> lib/pthread.h does have a typedef for pthread_spinlock_t, but it is = predicated on not having HAVE_PTHREAD_T defined (which I do): >=20 > Ah, OK. Could you try the following patch instead? The patch you attached allows compilation to complete on my mac, and = produces a working (according to my very cursory testing!) sort binary. I notice the following warnings though: ../../lib/glthread/lock.c: In function = 'glthread_recursive_lock_init_multithreaded': ../../lib/glthread/lock.c:319: warning: implicit declaration of function = 'pthread_mutexattr_init' ../../lib/glthread/lock.c:322: warning: implicit declaration of function = 'pthread_mutexattr_settype' ../../lib/glthread/lock.c:325: warning: implicit declaration of function = 'pthread_mutexattr_destroy' Which is odd, because /usr/include/pthread.h contains (unguarded) = prototypes for all those functions - so I assume the system pthread.h is = either being mangled, or entirely skipped when glthread/lock.c includes = the gnulib/pthread.h? * time passes * Hmm... looking at gnulib/pthread.h, am I right in assuming that threads = are now effectively disabled by gnulib on the mac in favour of a = selection of stub functions? In which case, I suppose those warnings = indicate that glthread/lock.c may attempt to call unstubbed functions = along some codepath and will then crash. > diff --git a/lib/pthread.in.h b/lib/pthread.in.h > index 4dad22a..84cf913 100644 > --- a/lib/pthread.in.h > +++ b/lib/pthread.in.h > @@ -40,6 +40,8 @@ > typedef int pthread_once_t; > typedef int pthread_rwlock_t; > typedef int pthread_rwlockattr_t; > +#endif > +#ifndef HAVE_PTHREAD_SPINLOCK_T > typedef int pthread_spinlock_t; > #endif >=20 > diff --git a/m4/pthread.m4 b/m4/pthread.m4 > index 69866cb..a2781eb 100644 > --- a/m4/pthread.m4 > +++ b/m4/pthread.m4 > @@ -6,19 +6,21 @@ dnl with or without modifications, as long as this = notice is preserved. >=20 > AC_DEFUN([gl_PTHREAD_CHECK], > [AC_CHECK_HEADERS_ONCE([pthread.h]) > + gl_keep_pthread_h=3D$ac_cv_header_pthread_h > + AC_CHECK_TYPES([pthread_t, pthread_spinlock_t], > + [], > + [gl_keep_pthread_h=3Dno]) >=20 > + PTHREAD_H=3D'pthread.h' > LIB_PTHREAD=3D > - PTHREAD_H=3D > - if test "$ac_cv_header_pthread_h" =3D yes; then > + if test "$gl_keep_pthread_h" =3D yes; then > + PTHREAD_H=3D > gl_saved_libs=3D$LIBS > AC_SEARCH_LIBS([pthread_create], [pthread], > [if test "$ac_cv_search_pthread_create" !=3D "none required"; = then > LIB_PTHREAD=3D"$ac_cv_search_pthread_create" > fi]) > LIBS=3D"$gl_saved_libs" > - else > - AC_CHECK_TYPES([pthread_t]) > - PTHREAD_H=3D'pthread.h' > fi >=20 > AC_SUBST([LIB_PTHREAD]) Cheers, --=20 Gary V. Vaughan (gary@gnu.org) --Apple-Mail-13--367529134 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) iEYEARECAAYFAkyX/8gACgkQFRMICSmD1gY1TgCgjYP2sl8qiJQJ99Oi0tDfwLdQ fEMAniZ3YDj7cVLq/8sgi07wmmqvG8kk =2jpm -----END PGP SIGNATURE----- --Apple-Mail-13--367529134-- From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 21 03:47:37 2010 Received: (at submit) by debbugs.gnu.org; 21 Sep 2010 07:47:37 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxxZg-0004VS-G9 for submit@debbugs.gnu.org; Tue, 21 Sep 2010 03:47:37 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxxZe-0004VN-E2 for submit@debbugs.gnu.org; Tue, 21 Sep 2010 03:47:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oxxbx-0005Da-BT for submit@debbugs.gnu.org; Tue, 21 Sep 2010 03:50:06 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:47385) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oxxbx-0005DV-8M for submit@debbugs.gnu.org; Tue, 21 Sep 2010 03:49:57 -0400 Received: from [140.186.70.92] (port=54231 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oxxbn-0001Bw-7W for bug-coreutils@gnu.org; Tue, 21 Sep 2010 03:49:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oxxbg-00059r-KS for bug-coreutils@gnu.org; Tue, 21 Sep 2010 03:49:47 -0400 Received: from vms173015pub.verizon.net ([206.46.173.15]:64331) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oxxbg-00059S-Ad; Tue, 21 Sep 2010 03:49:40 -0400 Received: from [192.168.1.10] ([unknown] [71.189.109.235]) by vms173015.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0L9300BTJ72PKAW7@vms173015.mailsrvcs.net>; Tue, 21 Sep 2010 02:49:38 -0500 (CDT) Message-id: <4C986391.2080004@cs.ucla.edu> Date: Tue, 21 Sep 2010 00:49:37 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 MIME-version: 1.0 To: "Gary V. Vaughan" Subject: Re: no pthread_spinlock_t on Mac OS 10.6.4 References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <4C96FD4F.9060308@cs.ucla.edu> <4C979A29.4010805@cs.ucla.edu> In-reply-to: Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Solaris 10 (1203?) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.4 (----) X-Debbugs-Envelope-To: submit Cc: bug-gnulib List , bug-coreutils@gnu.org, 7073@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.4 (----) On 09/20/2010 05:43 PM, Gary V. Vaughan wrote: > Hmm... looking at gnulib/pthread.h, am I right in assuming that > threads are now effectively disabled by gnulib on the mac in favour > of a selection of stub functions? In which case, I suppose those > warnings indicate that glthread/lock.c may attempt to call unstubbed > functions along some codepath and will then crash. Yes, that's right. The problem is that the gnulib i18n code includes pthread.h for its own purposes, and wants primitives that our trivial pthread replacement doesn't supply. Could you try the following patch instead? It tries an idea discussed earlier today, namely, fall back on mutexes if spinlocks aren't there. You'll need not only to update lib/pthread.in.h and m4/pthread.m4, but also to get that code from modules/pthread into your makefile; I did that by manually editing the "begin gnulib module pthread" section of lib/gnulib.mk. The patch below has a chance of working only because the gnulib i18n code doesn't need spinlocks: if it did, we'd need something fancier. Perhaps someday there should be a way to tell the i18n code "Hey! This app doesn't use threads so don't try to include or link to the thread library." Sorry, I can't easily test this as I don't use MacOS. diff --git a/lib/pthread.in.h b/lib/pthread.in.h index 0fdf9c3..f8e358b 100644 --- a/lib/pthread.in.h +++ b/lib/pthread.in.h @@ -19,6 +19,17 @@ /* Written by Paul Eggert and Glen Lenker. */ #ifndef _GL_PTHREAD_H_ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif + +/* The include_next requires a split double-inclusion guard. */ +#if @HAVE_PTHREAD_H@ +# @INCLUDE_NEXT@ @NEXT_PTHREAD_H@ +#endif + +#ifndef _GL_PTHREAD_H_ #define _GL_PTHREAD_H_ #include @@ -27,7 +38,7 @@ #include #include -#ifndef HAVE_PTHREAD_T +#if ! @HAVE_PTHREAD_T@ typedef int pthread_t; typedef int pthread_attr_t; typedef int pthread_barrier_t; @@ -40,9 +51,9 @@ typedef int pthread_once_t; typedef int pthread_rwlock_t; typedef int pthread_rwlockattr_t; - typedef int pthread_spinlock_t; #endif +#ifndef PTHREAD_COND_INITIALIZER #define PTHREAD_COND_INITIALIZER { 0 } #define PTHREAD_MUTEX_INITIALIZER { 0 } #define PTHREAD_ONCE_INIT { 0 } @@ -81,6 +92,9 @@ #define PTHREAD_SCOPE_SYSTEM 0 #define PTHREAD_SCOPE_PROCESS 1 +#endif + +#if ! @HAVE_PTHREAD_T@ /* Provide substitutes for the thread functions that should work adequately on a single-threaded implementation, where @@ -147,6 +161,24 @@ pthread_join (pthread_t thread, void **pvalue) } static inline int +pthread_mutexattr_destroy (pthread_mutexattr_t *attr) +{ + return 0; +} + +static inline int +pthread_mutexattr_init (pthread_mutexattr_t *attr) +{ + return 0; +} + +static inline int +pthread_mutexattr_settype (pthread_mutexattr_t *attr, int attr_type) +{ + return 0; +} + +static inline int pthread_mutex_destroy (pthread_mutex_t *mutex) { /* MUTEX is never seriously used. */ @@ -170,6 +202,12 @@ pthread_mutex_lock (pthread_mutex_t *mutex) } static inline int +pthread_mutex_trylock (pthread_mutex_t *mutex) +{ + return pthread_mutex_lock (mutex); +} + +static inline int pthread_mutex_unlock (pthread_mutex_t *mutex) { /* There is only one thread, so it always unlocks successfully. @@ -178,40 +216,44 @@ pthread_mutex_unlock (pthread_mutex_t *mutex) return 0; } +#endif + +#if ! @HAVE_PTHREAD_SPINLOCK_T@ + +/* Approximate spinlocks with mutexes. */ + +typedef pthread_mutex_t pthread_spinlock_t; + static inline int pthread_spin_init (pthread_spinlock_t *lock, int pshared) { - /* LOCK is never seriously used. */ - return 0; + return pthread_mutex_init (lock, NULL); } static inline int pthread_spin_destroy (pthread_spinlock_t *lock) { - /* LOCK is never seriously used. */ - return 0; + return pthread_mutex_destroy (lock); } static inline int pthread_spin_lock (pthread_spinlock_t *lock) { - /* Only one thread, so it always gets the lock. */ - return 0; + return pthread_mutex_lock (lock); } static inline int pthread_spin_trylock (pthread_spinlock_t *lock) { - /* Only one thread, so it always gets the lock. Assume that a - thread never tries a lock that it already holds. */ - return 0; + return pthread_mutex_trylock (lock); } static inline int pthread_spin_unlock (pthread_spinlock_t *lock) { - /* Only one thread, so spin locks are no-ops. */ - return 0; + return pthread_mutex_unlock (lock); } +#endif #endif /* _GL_PTHREAD_H_ */ +#endif /* _GL_PTHREAD_H_ */ diff --git a/m4/pthread.m4 b/m4/pthread.m4 index 69866cb..2b00944 100644 --- a/m4/pthread.m4 +++ b/m4/pthread.m4 @@ -5,25 +5,50 @@ dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_PTHREAD_CHECK], - [AC_CHECK_HEADERS_ONCE([pthread.h]) +[ + AC_REQUIRE([gl_PTHREAD_DEFAULTS]) + AC_CHECK_HEADERS_ONCE([pthread.h]) + gl_CHECK_NEXT_HEADERS([pthread.h]) + if test $ac_cv_header_pthread_h = yes; then + HAVE_PTHREAD_H=1 + else + HAVE_PTHREAD_H=0 + fi + + AC_CHECK_TYPES([pthread_t, pthread_spinlock_t]) + if test $ac_cv_type_pthread_t != yes; then + HAVE_PTHREAD_T=0 + fi + if test $ac_cv_type_pthread_spinlock_t != yes; then + HAVE_PTHREAD_SPINLOCK_T=0 + fi + + if test $ac_cv_header_pthread_h != yes || + test $ac_cv_type_pthread_t != yes || + test $ac_cv_type_pthread_spinlock_t != yes; then + PTHREAD_H='pthread.h' + fi LIB_PTHREAD= - PTHREAD_H= - if test "$ac_cv_header_pthread_h" = yes; then + 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' fi - AC_SUBST([LIB_PTHREAD]) - AC_SUBST([PTHREAD_H]) AC_REQUIRE([AC_C_INLINE]) AC_REQUIRE([AC_C_RESTRICT]) ]) + +AC_DEFUN([gl_PTHREAD_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_PTHREAD_H=1; AC_SUBST([HAVE_PTHREAD_H]) + HAVE_PTHREAD_T=1; AC_SUBST([HAVE_PTHREAD_T]) + HAVE_PTHREAD_SPINLOCK_T=1; AC_SUBST([HAVE_PTHREAD_SPINLOCK_T]) + PTHREAD_H=''; AC_SUBST([PTHREAD_H]) +]) diff --git a/modules/pthread b/modules/pthread index 51d5dbb..6d06464 100644 --- a/modules/pthread +++ b/modules/pthread @@ -18,9 +18,18 @@ BUILT_SOURCES += $(PTHREAD_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. pthread.h: pthread.in.h - $(AM_V_GEN)ln -f $(srcdir)/pthread.in.h $@ \ - || cp $(srcdir)/pthread.in.h $@ -MOSTLYCLEANFILES += pthread.h + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''HAVE_PTHREAD_H''@|$(HAVE_PTHREAD_H)|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_PTHREAD_H''@|$(NEXT_PTHREAD_H)|g' \ + -e 's|@''HAVE_PTHREAD_T''@|$(HAVE_PTHREAD_T)|g' \ + -e 's|@''HAVE_PTHREAD_SPINLOCK_T''@|$(HAVE_PTHREAD_SPINLOCK_T)|g' \ + < $(srcdir)/pthread.in.h; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += pthread.h pthread.h-t Include: From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 21 06:41:24 2010 Received: (at 7073) by debbugs.gnu.org; 21 Sep 2010 10:41:24 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oy0Hr-0005iM-To for submit@debbugs.gnu.org; Tue, 21 Sep 2010 06:41:24 -0400 Received: from mo-p00-ob.rzone.de ([81.169.146.160]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oy0Ho-0005iH-B9 for 7073@debbugs.gnu.org; Tue, 21 Sep 2010 06:41:21 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1285065831; l=920; s=domk; d=haible.de; h=Content-Transfer-Encoding:Content-Type:MIME-Version:In-Reply-To: References:Cc:Date:Subject:To:From:X-RZG-CLASS-ID:X-RZG-AUTH; bh=MWYuneHxkA1qHvKJRhuC5ajrRw0=; b=J0Q582Lhbn/pAC5gOmud2+bo5nLaLFdxzF06AF0pifnN40gSY0ka+jaJgRyFUqHVIAT P7QewJp93XyMp8zgrM0E0WDvkUBDjDvMZ+JY3448d73hxNbOnhPe7aqEqoYsweApJV0uQ F+5iS7h9w9f88QWiuPnEAtfEVVghRyWT5xY= X-RZG-AUTH: :Ln4Re0+Ic/6oZXR1YgKryK8brksyK8dozXDwHXjf9hj/zDJRaPAi/IaFpUs= X-RZG-CLASS-ID: mo00 Received: from linuix.haible.de (dslb-088-069-164-180.pools.arcor-ip.net [88.69.164.180]) by post.strato.de (fruni mo11) (RZmta 23.5) with ESMTP id 006659m8LA6vn9 ; Tue, 21 Sep 2010 12:43:50 +0200 (MEST) From: Bruno Haible To: bug-gnulib@gnu.org Subject: Re: no pthread_spinlock_t on Mac OS 10.6.4 Date: Tue, 21 Sep 2010 12:43:48 +0200 User-Agent: KMail/1.9.9 References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <4C986391.2080004@cs.ucla.edu> In-Reply-To: <4C986391.2080004@cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201009211243.50167.bruno@clisp.org> X-Spam-Score: -4.6 (----) X-Debbugs-Envelope-To: 7073 Cc: Paul Eggert , bug-coreutils@gnu.org, 7073@debbugs.gnu.org, "Gary V. Vaughan" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.9 (---) Hi Paul, > The problem is that the gnulib i18n code includes pthread.h for its > own purposes I wouldn't call it "the gnulib i18n code". The modules 'lock', 'tls', etc. are needed by the modules 'strsignal', 'fstrcmp', and 'localename'. Basically, every piece of code that wants to provide multithreaded access to a global variable (may it be a registry or cache or anything) needs locking. > and wants primitives that our trivial pthread replacement doesn't supply. Sure, when gnulib provides a "replacement" of a system header, it should not remove features from the system headers that other parties may rely upon. > + AC_CHECK_TYPES([pthread_t, pthread_spinlock_t]) It would be wise to include here. Not all systems define these types in ; some (e.g. mingw pthreads-win32) require a #include . This include is not part of AC_INCLUDES_DEFAULT. Bruno From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 21 13:20:55 2010 Received: (at submit) by debbugs.gnu.org; 21 Sep 2010 17:20:55 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oy6WV-00015i-8h for submit@debbugs.gnu.org; Tue, 21 Sep 2010 13:20:55 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oy6WT-00015d-GX for submit@debbugs.gnu.org; Tue, 21 Sep 2010 13:20:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oy6Yv-0006qs-Mw for submit@debbugs.gnu.org; Tue, 21 Sep 2010 13:23:26 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:32846) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oy6Yv-0006qj-L0 for submit@debbugs.gnu.org; Tue, 21 Sep 2010 13:23:25 -0400 Received: from [140.186.70.92] (port=37024 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oy6Yu-0002Gg-6F for bug-coreutils@gnu.org; Tue, 21 Sep 2010 13:23:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oy6Ys-0006q6-G1 for bug-coreutils@gnu.org; Tue, 21 Sep 2010 13:23:23 -0400 Received: from kiwi.cs.ucla.edu ([131.179.128.19]:55020) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oy6Ys-0006pb-5g; Tue, 21 Sep 2010 13:23:22 -0400 Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id o8LHNAIB006165; Tue, 21 Sep 2010 10:23:10 -0700 (PDT) Message-ID: <4C98E9FE.90101@cs.ucla.edu> Date: Tue, 21 Sep 2010 10:23:10 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 MIME-Version: 1.0 To: Bruno Haible Subject: Re: no pthread_spinlock_t on Mac OS 10.6.4 References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <4C986391.2080004@cs.ucla.edu> <201009211243.50167.bruno@clisp.org> In-Reply-To: <201009211243.50167.bruno@clisp.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.1 (-----) X-Debbugs-Envelope-To: submit Cc: bug-coreutils@gnu.org, bug-gnulib@gnu.org, 7073@debbugs.gnu.org, "Gary V. Vaughan" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.1 (-----) On 09/21/10 03:43, Bruno Haible wrote: > The modules 'lock', 'tls', > etc. are needed by the modules 'strsignal', 'fstrcmp', and 'localename'. > Basically, every piece of code that wants to provide multithreaded > access to a global variable (may it be a registry or cache or anything) > needs locking. Yes, but the problem is that coreutils does not need and does not want that multithreaded access, and yet it has to build the multithreaded support anyway. The runtime cost is probably small, but it introduces dependencies and porting problems that are not worth the hassle. And I worry that it may cause unreliability at runtime, on some platforms. It'd be better if applications could say "I don't need gnulib to be multithread-safe, and please don't bother with thread-safety" when it incorporates library code from gnulib. Even 'sort', the only coreutils program that is multithreaded, doesn't need the gnulib code itself to be thread-safe. >> + AC_CHECK_TYPES([pthread_t, pthread_spinlock_t]) > > It would be wise to include here. Not all systems define > these types in ; some (e.g. mingw pthreads-win32) require > a #include . This include is not part of AC_INCLUDES_DEFAULT. Thanks, I'll incorporate the following further patch in my next suggestion. I don't think this'll affect Gary's problem. --- old/m4/pthread.m4 2010-09-21 00:25:57.628643000 -0700 +++ new/m4/pthread.m4 2010-09-21 10:03:50.638754000 -0700 @@ -15,7 +15,11 @@ AC_DEFUN([gl_PTHREAD_CHECK], HAVE_PTHREAD_H=0 fi - AC_CHECK_TYPES([pthread_t, pthread_spinlock_t]) + AC_CHECK_TYPES([pthread_t, pthread_spinlock_t], [], [], + [AC_INCLUDES_DEFAULT[ + #if HAVE_PTHREAD_H + #include + #endif]]) if test $ac_cv_type_pthread_t != yes; then HAVE_PTHREAD_T=0 fi From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 21 13:38:39 2010 Received: (at submit) by debbugs.gnu.org; 21 Sep 2010 17:38:39 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oy6ne-0001D6-RQ for submit@debbugs.gnu.org; Tue, 21 Sep 2010 13:38:39 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oy6nc-0001D1-A7 for submit@debbugs.gnu.org; Tue, 21 Sep 2010 13:38:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oy6q4-0001pm-LB for submit@debbugs.gnu.org; Tue, 21 Sep 2010 13:41:09 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:56416) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oy6q4-0001pi-Ii for submit@debbugs.gnu.org; Tue, 21 Sep 2010 13:41:08 -0400 Received: from [140.186.70.92] (port=52519 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oy6pz-0001oy-GC for bug-coreutils@gnu.org; Tue, 21 Sep 2010 13:41:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oy6py-0001nj-AB for bug-coreutils@gnu.org; Tue, 21 Sep 2010 13:41:03 -0400 Received: from mo-p00-ob.rzone.de ([81.169.146.161]:46847) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oy6ps-0001ju-6Y; Tue, 21 Sep 2010 13:40:56 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1285090854; l=757; s=domk; d=haible.de; h=Content-Transfer-Encoding:Content-Type:MIME-Version:In-Reply-To: References:Cc:Date:Subject:To:From:X-RZG-CLASS-ID:X-RZG-AUTH; bh=ERcQNpA4jpL+IeOn/OVm8tr3L0U=; b=VVWt2qFebGa4hAorPnOcD6Coiyr0I8DbtBJqTNg31M2iRL2pSQoiYOlYlrx+daJK9oU TGVGI1YMAfwomraiILxW1JCCA76y/TEOkIdhr0UlNzH/3O1P5gHJDplmGQJlNjyfZBh7A Profp6tlgvQy6xCx8SAsDkLdOi42RRvlVEk= X-RZG-AUTH: :Ln4Re0+Ic/6oZXR1YgKryK8brksyK8dozXDwHXjf9hj/zDJRaPAi/IaFpUs= X-RZG-CLASS-ID: mo00 Received: from linuix.haible.de (dslb-088-069-164-180.pools.arcor-ip.net [88.69.164.180]) by post.strato.de (fruni mo57) (RZmta 23.5) with ESMTP id w020cam8LFnCTJ ; Tue, 21 Sep 2010 19:40:46 +0200 (MEST) From: Bruno Haible To: Paul Eggert Subject: Re: no pthread_spinlock_t on Mac OS 10.6.4 Date: Tue, 21 Sep 2010 19:40:43 +0200 User-Agent: KMail/1.9.9 References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <201009211243.50167.bruno@clisp.org> <4C98E9FE.90101@cs.ucla.edu> In-Reply-To: <4C98E9FE.90101@cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201009211940.46115.bruno@clisp.org> X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.6 (-----) X-Debbugs-Envelope-To: submit Cc: bug-coreutils@gnu.org, bug-gnulib@gnu.org, 7073@debbugs.gnu.org, "Gary V. Vaughan" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.7 (-----) Paul Eggert wrote: > the problem is that coreutils does not need and does not want > that multithreaded access, and yet it has to build the multithreaded > support anyway. ... > It'd be better if applications could say "I don't need gnulib to be > multithread-safe, and please don't bother with thread-safety" You can do so by inserting gl_use_threads_default=no in your configure.ac, before the invocations of gl_INIT_EARLY and gl_INIT. Users who install coreutils can do so by passing the option --disable-threads. But beware: since some coreutils programs _are_ multithreaded (namely, 'sort'), this option can introduce bugs, if you don't control very carefully which API you invoke while the concurrent threads are running. Bruno From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 21 14:54:48 2010 Received: (at submit) by debbugs.gnu.org; 21 Sep 2010 18:54:48 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oy7zL-0001mB-JX for submit@debbugs.gnu.org; Tue, 21 Sep 2010 14:54:48 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oy7zJ-0001m5-OK for submit@debbugs.gnu.org; Tue, 21 Sep 2010 14:54:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oy81l-0008Tq-Eq for submit@debbugs.gnu.org; Tue, 21 Sep 2010 14:57:18 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:46093) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oy81l-0008Tm-CX for submit@debbugs.gnu.org; Tue, 21 Sep 2010 14:57:17 -0400 Received: from [140.186.70.92] (port=59558 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oy81k-0007rB-8Y for bug-coreutils@gnu.org; Tue, 21 Sep 2010 14:57:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oy81i-0008TC-PS for bug-coreutils@gnu.org; Tue, 21 Sep 2010 14:57:16 -0400 Received: from kiwi.cs.ucla.edu ([131.179.128.19]:55888) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oy81i-0008SS-CM; Tue, 21 Sep 2010 14:57:14 -0400 Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id o8LIuuWW008031; Tue, 21 Sep 2010 11:56:56 -0700 (PDT) Message-ID: <4C98FFF8.805@cs.ucla.edu> Date: Tue, 21 Sep 2010 11:56:56 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 MIME-Version: 1.0 To: Bruno Haible Subject: Re: no pthread_spinlock_t on Mac OS 10.6.4 References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <201009211243.50167.bruno@clisp.org> <4C98E9FE.90101@cs.ucla.edu> <201009211940.46115.bruno@clisp.org> In-Reply-To: <201009211940.46115.bruno@clisp.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.1 (-----) X-Debbugs-Envelope-To: submit Cc: bug-coreutils@gnu.org, bug-gnulib@gnu.org, 7073@debbugs.gnu.org, "Gary V. Vaughan" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.1 (-----) On 09/21/10 10:40, Bruno Haible wrote: > You can do so by inserting > gl_use_threads_default=no > in your configure.ac, before the invocations of gl_INIT_EARLY and gl_INIT. Thanks, I didn't know that. I tried it, and found one minor glitch. "configure" said "checking for multithread API to use... no" which might imply to the casual reader that the resulting coreutils would not use multiple threads anywhere. How about appending "within threadlib" to that message? Also, it'd be helpful to document gl_use_threads_default. Perhaps the following patch? diff --git a/m4/threadlib.m4 b/m4/threadlib.m4 index bff01bc..b6c1817 100644 --- a/m4/threadlib.m4 +++ b/m4/threadlib.m4 @@ -282,7 +282,7 @@ int main () fi fi fi - AC_MSG_CHECKING([for multithread API to use]) + AC_MSG_CHECKING([for multithread API to use within threadlib]) AC_MSG_RESULT([$gl_threads_api]) AC_SUBST([LIBTHREAD]) AC_SUBST([LTLIBTHREAD]) diff --git a/modules/gettext b/modules/gettext index cab538e..787f237 100644 --- a/modules/gettext +++ b/modules/gettext @@ -38,6 +38,13 @@ gettext-h havelib configure.ac: +# If your applications do not need gnulib to be multithread-safe, +# either because they don't use threads or because they carefully +# control which APIs are invoked while concurrent threads are running, +# then you can avoid some build-time hassles and run-time overhead by +# inserting: +# gl_use_threads_default=no +# early in configure.ac, before the invocations of gl_INIT_EARLY and gl_INIT. AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT_VERSION([0.18.1]) diff --git a/modules/threadlib b/modules/threadlib index 9e3438c..3e2226a 100644 --- a/modules/threadlib +++ b/modules/threadlib @@ -13,6 +13,13 @@ configure.ac-early: gl_THREADLIB_EARLY configure.ac: +# If your applications do not need gnulib to be multithread-safe, +# either because they don't use threads or because they carefully +# control which APIs are invoked while concurrent threads are running, +# then you can avoid some build-time hassles and run-time overhead by +# inserting: +# gl_use_threads_default=no +# early in configure.ac, before the invocations of gl_INIT_EARLY and gl_INIT. gl_THREADLIB Makefile.am: From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 21 15:00:51 2010 Received: (at submit) by debbugs.gnu.org; 21 Sep 2010 19:00:51 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oy85D-0001p5-0J for submit@debbugs.gnu.org; Tue, 21 Sep 2010 15:00:51 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oy85B-0001p0-9R for submit@debbugs.gnu.org; Tue, 21 Sep 2010 15:00:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oy87c-0001Hi-9L for submit@debbugs.gnu.org; Tue, 21 Sep 2010 15:03:22 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:56944) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oy87c-0001He-7Y for submit@debbugs.gnu.org; Tue, 21 Sep 2010 15:03:20 -0400 Received: from [140.186.70.92] (port=34538 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oy87b-0004oB-ES for bug-coreutils@gnu.org; Tue, 21 Sep 2010 15:03:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oy87Z-0001Gu-Pm for bug-coreutils@gnu.org; Tue, 21 Sep 2010 15:03:19 -0400 Received: from kiwi.cs.ucla.edu ([131.179.128.19]:55973) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oy87Z-0001Gl-G7; Tue, 21 Sep 2010 15:03:17 -0400 Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id o8LJ37wk008149; Tue, 21 Sep 2010 12:03:07 -0700 (PDT) Message-ID: <4C99016B.5020000@cs.ucla.edu> Date: Tue, 21 Sep 2010 12:03:07 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 MIME-Version: 1.0 To: Bruno Haible Subject: Re: no pthread_spinlock_t on Mac OS 10.6.4 References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <201009211243.50167.bruno@clisp.org> <4C98E9FE.90101@cs.ucla.edu> <201009211940.46115.bruno@clisp.org> In-Reply-To: <201009211940.46115.bruno@clisp.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.1 (-----) X-Debbugs-Envelope-To: submit Cc: bug-coreutils@gnu.org, bug-gnulib@gnu.org, 7073@debbugs.gnu.org, "Gary V. Vaughan" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.1 (-----) Gary, could you please also try the following patch to coreutils, either by itself, or along with the updated gnulib patch? Thanks. configure: default gnulib to not using threads * configure.ac: Set gl_use_threads_default=no so that gnulib is configured without threading. The only coreutils application that uses threads (namely 'sort') does not invoke gnulib code in ways that could lead to races. Setting this flag simplifies configuration, making it less likely for builds to fail, and perhaps preventing some runtime gotchas. diff --git a/configure.ac b/configure.ac index acd397e..15368f2 100644 --- a/configure.ac +++ b/configure.ac @@ -35,6 +35,11 @@ AC_CONFIG_HEADERS([lib/config.h:lib/config.hin]) AM_INIT_AUTOMAKE([1.11.1 dist-xz color-tests parallel-tests]) AM_SILENT_RULES([yes]) # make --enable-silent-rules the default. +# The gnulib code need not be multithread-safe. Only 'sort' is +# multithreaded, and its concurrent threads do not require gnulib's +# multithread-aware code. +gl_use_threads_default=no + AC_PROG_CC_STDC AM_PROG_CC_C_O AC_PROG_CPP From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 22 01:08:58 2010 Received: (at 7073) by debbugs.gnu.org; 22 Sep 2010 05:08:58 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyHZh-0005he-Ua for submit@debbugs.gnu.org; Wed, 22 Sep 2010 01:08:58 -0400 Received: from caiajhbdcbhh.dreamhost.com ([208.97.132.177] helo=homiemail-a13.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyHZe-0005hY-V8 for 7073@debbugs.gnu.org; Wed, 22 Sep 2010 01:08:56 -0400 Received: from homiemail-a13.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a13.g.dreamhost.com (Postfix) with ESMTP id 5B2FB6A806B; Tue, 21 Sep 2010 22:11:28 -0700 (PDT) Received: from [192.168.1.3] (unknown [110.164.166.160]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: gary@vaughan.pe) by homiemail-a13.g.dreamhost.com (Postfix) with ESMTPSA id 407CD6A805F; Tue, 21 Sep 2010 22:11:24 -0700 (PDT) Subject: Re: no pthread_spinlock_t on Mac OS 10.6.4 Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Apple-Mail-18--265089779" From: "Gary V. Vaughan" In-Reply-To: <4C986391.2080004@cs.ucla.edu> Date: Wed, 22 Sep 2010 12:11:11 +0700 Content-Transfer-Encoding: 7bit Message-Id: <84CABAF6-9880-40A1-BCF7-AB5C04A852A8@gnu.org> References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <4C96FD4F.9060308@cs.ucla.edu> <4C979A29.4010805@cs.ucla.edu> <4C986391.2080004@cs.ucla.edu> To: Paul Eggert X-Pgp-Agent: GPGMail 1.3.0 X-Mailer: Apple Mail (2.1081) X-Spam-Score: -3.3 (---) X-Debbugs-Envelope-To: 7073 Cc: bug-gnulib List , bug-coreutils@gnu.org, 7073@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.1 (---) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --Apple-Mail-18--265089779 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi Paul, On 21 Sep 2010, at 14:49, Paul Eggert wrote: > Could you try the following patch instead? It tries an idea discussed > earlier today, namely, fall back on mutexes if spinlocks aren't there. > You'll need not only to update lib/pthread.in.h and m4/pthread.m4, but > also to get that code from modules/pthread into your makefile; I did > that by manually editing the "begin gnulib module pthread" section of > lib/gnulib.mk. I like this idea much better than disabling threads entirely on macosx. But the patch causes a bizarre and apparently unrelated compilation error: ; make V=3D1 gcc -std=3Dgnu99 -I. -I../lib -g -O2 -MT sigprocmask.o -MD -MP = -MF .deps/sigprocmask.Tpo -c -o sigprocmask.o ../lib/sigprocmask.c ../lib/sigprocmask.c:87: error: expected identifier or '(' before = 'const' ../lib/sigprocmask.c:87: error: expected ')' before '&' token ../lib/sigprocmask.c:87: error: expected ')' before '!=3D' token ../lib/sigprocmask.c:103: error: expected ')' before '*' token ../lib/sigprocmask.c:103: error: expected ')' before '=3D' token ../lib/sigprocmask.c:110: error: expected ')' before '*' token ../lib/sigprocmask.c:110: error: expected ')' before '|=3D' token ../lib/sigprocmask.c:130: error: expected ')' before '*' token ../lib/sigprocmask.c:130: error: expected ')' before '&=3D' token ../lib/sigprocmask.c:151: error: expected ')' before '*' token ../lib/sigprocmask.c:151: error: expected ')' before=20 Apparently caused by an errant sigprocmask functions sharing names with system macros, to create this mess: ; gcc -std=3Dc99 -E ../lib/sigprocmask.c | sed '/^$/d' | cat -n [[...]] 2376 int 2377 ((*(const sigset_t *set) & __sigbits(int sig)) !=3D 0) 2378 { 2379 if (sig >=3D 0 && sig < 32) 2380 { 2381 return (*set >> sig) & 1; 2382 } 2383 else 2384 return 0; 2385 } 2386 int 2387 (*(sigset_t *set) =3D 0, 0) 2388 { 2389 *set =3D 0; 2390 return 0; 2391 } 2392 int 2393 (*(sigset_t *set) |=3D __sigbits(int sig), 0) 2394 { 2395 if (sig >=3D 0 && sig < 32) 2396 { 2397 *set |=3D 1U << sig; 2398 return 0; 2399 } 2400 else 2401 { 2402 (*__error()) =3D 22; 2403 return -1; 2404 } 2405 } 2406 int 2407 (*(sigset_t *set) &=3D ~__sigbits(int sig), 0) 2408 { 2409 if (sig >=3D 0 && sig < 32) 2410 { 2411 *set &=3D ~(1U << sig); 2412 return 0; 2413 } 2414 else 2415 { 2416 (*__error()) =3D 22; 2417 return -1; 2418 } 2419 } 2420 int 2421 (*(sigset_t *set) =3D ~(sigset_t)0, 0) 2422 { 2423 *set =3D ((2U << (32 - 1)) - 1) & ~ 0; 2424 return 0; 2425 } I suppose this is a result of header ordering? The only things that = have changed since my previous report are that I've applied the patch below, tweaked the generated gnulib.mk as suggested, and updated the gnulib submodule to the tip of master so that the patch can apply. I tried removing the `# include_next ' but the above error still stands even then. So maybe this is an entirely new problem with latest gnulib? > Sorry, I can't easily test this as I don't use MacOS. No problem, glad to help. Sorry I couldn't unravel this any further by myself. > diff --git a/lib/pthread.in.h b/lib/pthread.in.h > index 0fdf9c3..f8e358b 100644 > --- a/lib/pthread.in.h > +++ b/lib/pthread.in.h > @@ -19,6 +19,17 @@ > /* Written by Paul Eggert and Glen Lenker. */ >=20 > #ifndef _GL_PTHREAD_H_ > + > +#if __GNUC__ >=3D 3 > +@PRAGMA_SYSTEM_HEADER@ > +#endif > + > +/* The include_next requires a split double-inclusion guard. */ > +#if @HAVE_PTHREAD_H@ > +# @INCLUDE_NEXT@ @NEXT_PTHREAD_H@ > +#endif > + > +#ifndef _GL_PTHREAD_H_ > #define _GL_PTHREAD_H_ >=20 > #include > @@ -27,7 +38,7 @@ > #include > #include >=20 > -#ifndef HAVE_PTHREAD_T > +#if ! @HAVE_PTHREAD_T@ > typedef int pthread_t; > typedef int pthread_attr_t; > typedef int pthread_barrier_t; > @@ -40,9 +51,9 @@ > typedef int pthread_once_t; > typedef int pthread_rwlock_t; > typedef int pthread_rwlockattr_t; > - typedef int pthread_spinlock_t; > #endif >=20 > +#ifndef PTHREAD_COND_INITIALIZER > #define PTHREAD_COND_INITIALIZER { 0 } > #define PTHREAD_MUTEX_INITIALIZER { 0 } > #define PTHREAD_ONCE_INIT { 0 } > @@ -81,6 +92,9 @@ >=20 > #define PTHREAD_SCOPE_SYSTEM 0 > #define PTHREAD_SCOPE_PROCESS 1 > +#endif > + > +#if ! @HAVE_PTHREAD_T@ >=20 > /* Provide substitutes for the thread functions that should work > adequately on a single-threaded implementation, where > @@ -147,6 +161,24 @@ pthread_join (pthread_t thread, void **pvalue) > } >=20 > static inline int > +pthread_mutexattr_destroy (pthread_mutexattr_t *attr) > +{ > + return 0; > +} > + > +static inline int > +pthread_mutexattr_init (pthread_mutexattr_t *attr) > +{ > + return 0; > +} > + > +static inline int > +pthread_mutexattr_settype (pthread_mutexattr_t *attr, int attr_type) > +{ > + return 0; > +} > + > +static inline int > pthread_mutex_destroy (pthread_mutex_t *mutex) > { > /* MUTEX is never seriously used. */ > @@ -170,6 +202,12 @@ pthread_mutex_lock (pthread_mutex_t *mutex) > } >=20 > static inline int > +pthread_mutex_trylock (pthread_mutex_t *mutex) > +{ > + return pthread_mutex_lock (mutex); > +} > + > +static inline int > pthread_mutex_unlock (pthread_mutex_t *mutex) > { > /* There is only one thread, so it always unlocks successfully. > @@ -178,40 +216,44 @@ pthread_mutex_unlock (pthread_mutex_t *mutex) > return 0; > } >=20 > +#endif > + > +#if ! @HAVE_PTHREAD_SPINLOCK_T@ > + > +/* Approximate spinlocks with mutexes. */ > + > +typedef pthread_mutex_t pthread_spinlock_t; > + > static inline int > pthread_spin_init (pthread_spinlock_t *lock, int pshared) > { > - /* LOCK is never seriously used. */ > - return 0; > + return pthread_mutex_init (lock, NULL); > } >=20 > static inline int > pthread_spin_destroy (pthread_spinlock_t *lock) > { > - /* LOCK is never seriously used. */ > - return 0; > + return pthread_mutex_destroy (lock); > } >=20 > static inline int > pthread_spin_lock (pthread_spinlock_t *lock) > { > - /* Only one thread, so it always gets the lock. */ > - return 0; > + return pthread_mutex_lock (lock); > } >=20 > static inline int > pthread_spin_trylock (pthread_spinlock_t *lock) > { > - /* Only one thread, so it always gets the lock. Assume that a > - thread never tries a lock that it already holds. */ > - return 0; > + return pthread_mutex_trylock (lock); > } >=20 > static inline int > pthread_spin_unlock (pthread_spinlock_t *lock) > { > - /* Only one thread, so spin locks are no-ops. */ > - return 0; > + return pthread_mutex_unlock (lock); > } > +#endif >=20 > #endif /* _GL_PTHREAD_H_ */ > +#endif /* _GL_PTHREAD_H_ */ > diff --git a/m4/pthread.m4 b/m4/pthread.m4 > index 69866cb..2b00944 100644 > --- a/m4/pthread.m4 > +++ b/m4/pthread.m4 > @@ -5,25 +5,50 @@ dnl gives unlimited permission to copy and/or = distribute it, > dnl with or without modifications, as long as this notice is = preserved. >=20 > AC_DEFUN([gl_PTHREAD_CHECK], > - [AC_CHECK_HEADERS_ONCE([pthread.h]) > +[ > + AC_REQUIRE([gl_PTHREAD_DEFAULTS]) > + AC_CHECK_HEADERS_ONCE([pthread.h]) > + gl_CHECK_NEXT_HEADERS([pthread.h]) > + if test $ac_cv_header_pthread_h =3D yes; then > + HAVE_PTHREAD_H=3D1 > + else > + HAVE_PTHREAD_H=3D0 > + fi > + > + AC_CHECK_TYPES([pthread_t, pthread_spinlock_t]) > + if test $ac_cv_type_pthread_t !=3D yes; then > + HAVE_PTHREAD_T=3D0 > + fi > + if test $ac_cv_type_pthread_spinlock_t !=3D yes; then > + HAVE_PTHREAD_SPINLOCK_T=3D0 > + fi > + > + if test $ac_cv_header_pthread_h !=3D yes || > + test $ac_cv_type_pthread_t !=3D yes || > + test $ac_cv_type_pthread_spinlock_t !=3D yes; then > + PTHREAD_H=3D'pthread.h' > + fi >=20 > LIB_PTHREAD=3D > - PTHREAD_H=3D > - if test "$ac_cv_header_pthread_h" =3D yes; then > + if test $ac_cv_header_pthread_h =3D yes; then > gl_saved_libs=3D$LIBS > AC_SEARCH_LIBS([pthread_create], [pthread], > [if test "$ac_cv_search_pthread_create" !=3D "none required"; = then > LIB_PTHREAD=3D"$ac_cv_search_pthread_create" > fi]) > LIBS=3D"$gl_saved_libs" > - else > - AC_CHECK_TYPES([pthread_t]) > - PTHREAD_H=3D'pthread.h' > fi > - > AC_SUBST([LIB_PTHREAD]) > - AC_SUBST([PTHREAD_H]) >=20 > AC_REQUIRE([AC_C_INLINE]) > AC_REQUIRE([AC_C_RESTRICT]) > ]) > + > +AC_DEFUN([gl_PTHREAD_DEFAULTS], > +[ > + dnl Assume proper GNU behavior unless another module says = otherwise. > + HAVE_PTHREAD_H=3D1; AC_SUBST([HAVE_PTHREAD_H]) > + HAVE_PTHREAD_T=3D1; AC_SUBST([HAVE_PTHREAD_T]) > + HAVE_PTHREAD_SPINLOCK_T=3D1; = AC_SUBST([HAVE_PTHREAD_SPINLOCK_T]) > + PTHREAD_H=3D''; AC_SUBST([PTHREAD_H]) > +]) > diff --git a/modules/pthread b/modules/pthread > index 51d5dbb..6d06464 100644 > --- a/modules/pthread > +++ b/modules/pthread > @@ -18,9 +18,18 @@ BUILT_SOURCES +=3D $(PTHREAD_H) > # We need the following in order to create when the system > # doesn't have one that works with the given compiler. > pthread.h: pthread.in.h > - $(AM_V_GEN)ln -f $(srcdir)/pthread.in.h $@ \ > - || cp $(srcdir)/pthread.in.h $@ > -MOSTLYCLEANFILES +=3D pthread.h > + $(AM_V_GEN)rm -f $@-t $@ && \ > + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ > + sed -e 's|@''HAVE_PTHREAD_H''@|$(HAVE_PTHREAD_H)|g' \ > + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ > + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' = \ > + -e 's|@''NEXT_PTHREAD_H''@|$(NEXT_PTHREAD_H)|g' \ > + -e 's|@''HAVE_PTHREAD_T''@|$(HAVE_PTHREAD_T)|g' \ > + -e = 's|@''HAVE_PTHREAD_SPINLOCK_T''@|$(HAVE_PTHREAD_SPINLOCK_T)|g' \ > + < $(srcdir)/pthread.in.h; \ > + } > $@-t && \ > + mv $@-t $@ > +MOSTLYCLEANFILES +=3D pthread.h pthread.h-t >=20 > Include: > Cheers, --=20 Gary V. Vaughan (gary@gnu.org) --Apple-Mail-18--265089779 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) iEYEARECAAYFAkyZj+8ACgkQFRMICSmD1gai8ACgtoCE0m0z0Nr1Na71aL/WePZ3 EZUAnRpVuHiXw0h1Sn0FzotI0ezyTWgG =kowt -----END PGP SIGNATURE----- --Apple-Mail-18--265089779-- From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 22 01:31:18 2010 Received: (at submit) by debbugs.gnu.org; 22 Sep 2010 05:31:19 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyHvK-0005qt-Bz for submit@debbugs.gnu.org; Wed, 22 Sep 2010 01:31:18 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyHvI-0005qe-BD for submit@debbugs.gnu.org; Wed, 22 Sep 2010 01:31:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OyHxl-0000bZ-KV for submit@debbugs.gnu.org; Wed, 22 Sep 2010 01:33:50 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:41643) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyHxl-0000bV-Ip for submit@debbugs.gnu.org; Wed, 22 Sep 2010 01:33:49 -0400 Received: from [140.186.70.92] (port=36369 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OyHxk-0005rp-CP for bug-coreutils@gnu.org; Wed, 22 Sep 2010 01:33:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OyHxj-0000b2-7R for bug-coreutils@gnu.org; Wed, 22 Sep 2010 01:33:48 -0400 Received: from vms173009pub.verizon.net ([206.46.173.9]:60128) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyHxi-0000am-VX; Wed, 22 Sep 2010 01:33:47 -0400 Received: from [192.168.1.10] ([unknown] [71.189.109.235]) by vms173009.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0L9400C9IVG6OX8W@vms173009.mailsrvcs.net>; Wed, 22 Sep 2010 00:33:45 -0500 (CDT) Message-id: <4C999536.3030804@cs.ucla.edu> Date: Tue, 21 Sep 2010 22:33:42 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 MIME-version: 1.0 To: "Gary V. Vaughan" Subject: Re: no pthread_spinlock_t on Mac OS 10.6.4 References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <4C96FD4F.9060308@cs.ucla.edu> <4C979A29.4010805@cs.ucla.edu> <4C986391.2080004@cs.ucla.edu> <84CABAF6-9880-40A1-BCF7-AB5C04A852A8@gnu.org> In-reply-to: <84CABAF6-9880-40A1-BCF7-AB5C04A852A8@gnu.org> Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Solaris 10 (1203?) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.4 (----) X-Debbugs-Envelope-To: submit Cc: bug-gnulib List , bug-coreutils@gnu.org, 7073@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.5 (----) On 09/21/2010 10:11 PM, Gary V. Vaughan wrote: > But the patch causes a bizarre and apparently unrelated compilation > error: > > ; make V=1 > gcc -std=gnu99 -I. -I../lib -g -O2 -MT sigprocmask.o -MD -MP -MF .deps/sigprocmask.Tpo -c -o sigprocmask.o ../lib/sigprocmask.c > ../lib/sigprocmask.c:87: error: expected identifier or '(' before 'const' I don't see how the patch could do that, unless sigprocmask.c includes pthread.h somehow. Can you verify whether that happens, by using gcc -E? If so, which file is the immediate includer of pthread.h? And if not, what's the difference beween the output of gcc -E sigprocmask.c, with and without the patch? Also, could you please try the simpler patch here instead? http://lists.gnu.org/archive/html/bug-coreutils/2010-09/msg00080.html From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 22 03:44:41 2010 Received: (at submit) by debbugs.gnu.org; 22 Sep 2010 07:44:41 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyK0O-0006k6-EZ for submit@debbugs.gnu.org; Wed, 22 Sep 2010 03:44:40 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyK0N-0006jr-4H for submit@debbugs.gnu.org; Wed, 22 Sep 2010 03:44:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OyK2p-0003zP-Gg for submit@debbugs.gnu.org; Wed, 22 Sep 2010 03:47:13 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:40284) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyK2p-0003zL-Ds for submit@debbugs.gnu.org; Wed, 22 Sep 2010 03:47:11 -0400 Received: from [140.186.70.92] (port=34688 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OyK2o-0007ex-4k for bug-coreutils@gnu.org; Wed, 22 Sep 2010 03:47:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OyK2m-0003yh-By for bug-coreutils@gnu.org; Wed, 22 Sep 2010 03:47:09 -0400 Received: from mailbigip.dreamhost.com ([208.97.132.5]:42767 helo=homiemail-a23.g.dreamhost.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyK2m-0003yW-7k; Wed, 22 Sep 2010 03:47:08 -0400 Received: from homiemail-a23.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a23.g.dreamhost.com (Postfix) with ESMTP id 724F54B0063; Wed, 22 Sep 2010 00:47:07 -0700 (PDT) Received: from [192.168.1.3] (unknown [110.164.166.160]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: gary@vaughan.pe) by homiemail-a23.g.dreamhost.com (Postfix) with ESMTPSA id DFC7F4B006D; Wed, 22 Sep 2010 00:47:05 -0700 (PDT) Subject: Re: no pthread_spinlock_t on Mac OS 10.6.4 Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Apple-Mail-19--255743884" From: "Gary V. Vaughan" In-Reply-To: <4C999536.3030804@cs.ucla.edu> Date: Wed, 22 Sep 2010 14:46:57 +0700 Content-Transfer-Encoding: 7bit Message-Id: <1D8D0B08-A9BA-4515-8C6F-245BBBCCCF3E@gnu.org> References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <4C96FD4F.9060308@cs.ucla.edu> <4C979A29.4010805@cs.ucla.edu> <4C986391.2080004@cs.ucla.edu> <84CABAF6-9880-40A1-BCF7-AB5C04A852A8@gnu.org> <4C999536.3030804@cs.ucla.edu> To: Paul Eggert X-Pgp-Agent: GPGMail 1.3.0 X-Mailer: Apple Mail (2.1081) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.4 (-----) X-Debbugs-Envelope-To: submit Cc: bug-gnulib List , bug-coreutils@gnu.org, 7073@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.4 (-----) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --Apple-Mail-19--255743884 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi Paul, Thanks for the swift response. On 22 Sep 2010, at 12:33, Paul Eggert wrote: > On 09/21/2010 10:11 PM, Gary V. Vaughan wrote: >=20 >> But the patch causes a bizarre and apparently unrelated compilation >> error: >>=20 >> ; make V=3D1 >> gcc -std=3Dgnu99 -I. -I../lib -g -O2 -MT sigprocmask.o -MD -MP = -MF .deps/sigprocmask.Tpo -c -o sigprocmask.o ../lib/sigprocmask.c >> ../lib/sigprocmask.c:87: error: expected identifier or '(' before = 'const' >=20 > I don't see how the patch could do that, unless sigprocmask.c > includes pthread.h somehow. Can you verify whether that happens, > by using gcc -E? If so, which file is the immediate includer > of pthread.h? And if not, what's the difference beween > the output of gcc -E sigprocmask.c, with and without the patch? You're right. I guess my working directory had gotten out of synch with something. After a `git reset --hard master && git clean -d -x -f', and applying the patch again freshly, it works perfectly well, and without the problems of undefined symbols like the previous patch. Sorry for the noise. > Also, could you please try the simpler patch here instead? >=20 > http://lists.gnu.org/archive/html/bug-coreutils/2010-09/msg00080.html I'll reply in that thread when I've had time to try it. Cheers, --=20 Gary V. Vaughan (gary@gnu.org)= --Apple-Mail-19--255743884 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) iEYEARECAAYFAkyZtHIACgkQFRMICSmD1gYaUwCeIXFMCyMpRL/ytxPzeqizouoi 2gEAn1yzv2OhskVkP6h2eJ7EgONpoZd6 =vB6c -----END PGP SIGNATURE----- --Apple-Mail-19--255743884-- From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 22 04:16:12 2010 Received: (at submit) by debbugs.gnu.org; 22 Sep 2010 08:16:12 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyKUt-0006xt-R1 for submit@debbugs.gnu.org; Wed, 22 Sep 2010 04:16:12 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyKUs-0006xd-GD for submit@debbugs.gnu.org; Wed, 22 Sep 2010 04:16:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OyKXL-0001M7-8p for submit@debbugs.gnu.org; Wed, 22 Sep 2010 04:18:45 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:44320) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyKXL-0001M1-50 for submit@debbugs.gnu.org; Wed, 22 Sep 2010 04:18:43 -0400 Received: from [140.186.70.92] (port=33815 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OyKXK-0006jF-3B for bug-coreutils@gnu.org; Wed, 22 Sep 2010 04:18:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OyKXI-0001LG-IW for bug-coreutils@gnu.org; Wed, 22 Sep 2010 04:18:42 -0400 Received: from caiajhbdcbef.dreamhost.com ([208.97.132.145]:41460 helo=homiemail-a18.g.dreamhost.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyKXI-0001L8-Av; Wed, 22 Sep 2010 04:18:40 -0400 Received: from homiemail-a18.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a18.g.dreamhost.com (Postfix) with ESMTP id 695FC250074; Wed, 22 Sep 2010 01:18:39 -0700 (PDT) Received: from [192.168.1.3] (unknown [110.164.166.160]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: gary@vaughan.pe) by homiemail-a18.g.dreamhost.com (Postfix) with ESMTPSA id 8326925006C; Wed, 22 Sep 2010 01:18:36 -0700 (PDT) Subject: Re: no pthread_spinlock_t on Mac OS 10.6.4 Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Apple-Mail-22--253852450" From: "Gary V. Vaughan" In-Reply-To: <4C99016B.5020000@cs.ucla.edu> Date: Wed, 22 Sep 2010 15:18:29 +0700 Content-Transfer-Encoding: 7bit Message-Id: References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <201009211243.50167.bruno@clisp.org> <4C98E9FE.90101@cs.ucla.edu> <201009211940.46115.bruno@clisp.org> <4C99016B.5020000@cs.ucla.edu> To: Paul Eggert X-Pgp-Agent: GPGMail 1.3.0 X-Mailer: Apple Mail (2.1081) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.4 (-----) X-Debbugs-Envelope-To: submit Cc: bug-gnulib@gnu.org, bug-coreutils@gnu.org, Bruno Haible , 7073@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.4 (-----) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --Apple-Mail-22--253852450 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi Paul, On 22 Sep 2010, at 02:03, Paul Eggert wrote: > Gary, could you please also try the following patch to coreutils, > either by itself, gcc -std=3Dgnu99 -I. -I../../src -I../lib -I../../lib -g -O2 -MT = sort.o -MD -MP -MF .deps/sort.Tpo -c -o sort.o ../../src/sort.c ../../src/sort.c:243: error: expected specifier-qualifier-list before = 'pthread_spinlock_t' ../../src/sort.c: In function 'lock_node': ../../src/sort.c:3159: warning: implicit declaration of function = 'pthread_spin_lock' ../../src/sort.c:3159: error: 'struct merge_node' has no member named = 'lock' ../../src/sort.c: In function 'unlock_node': ../../src/sort.c:3167: warning: implicit declaration of function = 'pthread_spin_unlock' ../../src/sort.c:3167: error: 'struct merge_node' has no member named = 'lock' ../../src/sort.c: In function 'sortlines': ../../src/sort.c:3445: error: 'pthread_spinlock_t' undeclared (first use = in this function) ../../src/sort.c:3445: error: (Each undeclared identifier is reported = only once ../../src/sort.c:3445: error: for each function it appears in.) ../../src/sort.c:3445: error: expected ';' before 'lock' ../../src/sort.c:3446: warning: implicit declaration of function = 'pthread_spin_init' ../../src/sort.c:3446: error: 'lock' undeclared (first use in this = function) ../../src/sort.c:3448: warning: excess elements in struct initializer ../../src/sort.c:3448: warning: (near initialization for 'node') ../../src/sort.c: In function 'sort': ../../src/sort.c:3759: error: 'pthread_spinlock_t' undeclared (first use = in this function) ../../src/sort.c:3759: error: expected ';' before 'lock' ../../src/sort.c:3760: error: 'lock' undeclared (first use in this = function) ../../src/sort.c:3763: warning: excess elements in struct initializer ../../src/sort.c:3763: warning: (near initialization for 'node') > or along with the updated gnulib patch? Builds, and sort appears to be working, as it was in my last message on = this thread. Actually this patch seems to make no discernable difference to the = behaviour of the build in both cases above. > configure: default gnulib to not using threads >=20 > * configure.ac: Set gl_use_threads_default=3Dno so that gnulib is > configured without threading. The only coreutils application that > uses threads (namely 'sort') does not invoke gnulib code in ways > that could lead to races. Setting this flag simplifies > configuration, making it less likely for builds to fail, and > perhaps preventing some runtime gotchas. Cheers, --=20 Gary V. Vaughan (gary@gnu.org)= --Apple-Mail-22--253852450 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) iEYEARECAAYFAkyZu9UACgkQFRMICSmD1gbSCACghXt+LGf9vNEw7Ww8UrHo3EXk Qn0AoIIVF2pl06UeUaF/ctxpRcIrJ3AB =3sY0 -----END PGP SIGNATURE----- --Apple-Mail-22--253852450-- From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 22 04:32:57 2010 Received: (at submit) by debbugs.gnu.org; 22 Sep 2010 08:32:57 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyKl7-00074Z-It for submit@debbugs.gnu.org; Wed, 22 Sep 2010 04:32:57 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyKl5-00074O-JS for submit@debbugs.gnu.org; Wed, 22 Sep 2010 04:32:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OyKnZ-0003nU-3a for submit@debbugs.gnu.org; Wed, 22 Sep 2010 04:35:30 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:37783) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyKnZ-0003nQ-1v for submit@debbugs.gnu.org; Wed, 22 Sep 2010 04:35:29 -0400 Received: from [140.186.70.92] (port=47487 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OyKnX-0003sy-J2 for bug-coreutils@gnu.org; Wed, 22 Sep 2010 04:35:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OyKnW-0003mu-4W for bug-coreutils@gnu.org; Wed, 22 Sep 2010 04:35:27 -0400 Received: from vms173003pub.verizon.net ([206.46.173.3]:41076) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyKnW-0003ma-1W; Wed, 22 Sep 2010 04:35:26 -0400 Received: from [192.168.1.10] ([unknown] [71.189.109.235]) by vms173003.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0L9500NFA3UH4TR0@vms173003.mailsrvcs.net>; Wed, 22 Sep 2010 03:35:11 -0500 (CDT) Message-id: <4C99BFB9.90702@cs.ucla.edu> Date: Wed, 22 Sep 2010 01:35:05 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 MIME-version: 1.0 To: "Gary V. Vaughan" Subject: Re: no pthread_spinlock_t on Mac OS 10.6.4 References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <4C96FD4F.9060308@cs.ucla.edu> <4C979A29.4010805@cs.ucla.edu> <4C986391.2080004@cs.ucla.edu> <84CABAF6-9880-40A1-BCF7-AB5C04A852A8@gnu.org> <4C999536.3030804@cs.ucla.edu> <1D8D0B08-A9BA-4515-8C6F-245BBBCCCF3E@gnu.org> In-reply-to: <1D8D0B08-A9BA-4515-8C6F-245BBBCCCF3E@gnu.org> Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Solaris 10 (1203?) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.5 (----) X-Debbugs-Envelope-To: submit Cc: bug-gnulib List , bug-coreutils@gnu.org, 7073@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.5 (----) On 09/22/2010 12:46 AM, Gary V. Vaughan wrote: > After a `git reset --hard master && git clean -d -x -f', and > applying the patch again freshly, it works perfectly well, and without > the problems of undefined symbols like the previous patch. OK, thanks, I pushed that patch, here: http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commit;h=66cc02681886cc3da705d0efb7a30a54bc8ce6b4 From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 22 04:41:17 2010 Received: (at submit) by debbugs.gnu.org; 22 Sep 2010 08:41:17 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyKtA-0007AY-2Z for submit@debbugs.gnu.org; Wed, 22 Sep 2010 04:41:16 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyKt8-0007AH-3W for submit@debbugs.gnu.org; Wed, 22 Sep 2010 04:41:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OyKvb-0005A8-Fp for submit@debbugs.gnu.org; Wed, 22 Sep 2010 04:43:48 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:48683) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyKvb-0005A2-Cd for submit@debbugs.gnu.org; Wed, 22 Sep 2010 04:43:47 -0400 Received: from [140.186.70.92] (port=56142 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OyKva-0001I9-3B for bug-coreutils@gnu.org; Wed, 22 Sep 2010 04:43:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OyKvY-00059L-Kf for bug-coreutils@gnu.org; Wed, 22 Sep 2010 04:43:45 -0400 Received: from vms173001pub.verizon.net ([206.46.173.1]:58632) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyKvY-000598-HW; Wed, 22 Sep 2010 04:43:44 -0400 Received: from [192.168.1.10] ([unknown] [71.189.109.235]) by vms173001.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0L9500MZJ48PSR9R@vms173001.mailsrvcs.net>; Wed, 22 Sep 2010 03:43:43 -0500 (CDT) Message-id: <4C99C1B9.3090704@cs.ucla.edu> Date: Wed, 22 Sep 2010 01:43:37 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 MIME-version: 1.0 To: "Gary V. Vaughan" Subject: Re: no pthread_spinlock_t on Mac OS 10.6.4 References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <201009211243.50167.bruno@clisp.org> <4C98E9FE.90101@cs.ucla.edu> <201009211940.46115.bruno@clisp.org> <4C99016B.5020000@cs.ucla.edu> In-reply-to: Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Solaris 10 (1203?) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.6 (----) X-Debbugs-Envelope-To: submit Cc: bug-gnulib@gnu.org, bug-coreutils@gnu.org, Bruno Haible , 7073@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.6 (----) On 09/22/2010 01:18 AM, Gary V. Vaughan wrote: > Actually this patch seems to make no discernable difference to the behaviour of the build in both cases above. That's odd, because adding "gl_use_threads_default=no" should cause "configure" to default to --disable-threads behavior. What is the difference between the outputs of "./configure --disable-threads" and of "./configure --enable-threads=posix"? The former should behave as if the patch were installed, and the latter as if it were not installed. Assuming you have the gnulib patch that I just pushed, you should see minor changes in the output of "configure", as follows, where the "+" lines are with the patch (or with --enable-threads=posix) and the "-" lines are without the patch (or with --disable-threads). @@ -333,7 +333,10 @@ checking whether getc_unlocked is declar checking whether we are using the GNU C Library 2.1 or newer... yes checking for wchar_t... yes checking whether NULL can be used in arbitrary expressions... yes -checking for multithread API to use... none +checking whether imported symbols can be declared weak... yes +checking for pthread.h... (cached) yes +checking for pthread_kill in -lpthread... yes +checking for multithread API to use... posix checking for stdlib.h... (cached) yes checking for GNU libc compatible malloc... yes checking whether mbrtowc and mbstate_t are properly declared... (cached) yes @@ -609,6 +612,7 @@ checking whether linkat handles trailing checking whether locale.h conforms to POSIX:2001... yes checking whether locale.h defines locale_t... yes checking whether duplocale is declared without a macro... yes +checking for pthread_rwlock_t... yes checking whether lseek detects pipes... yes checking for stdlib.h... (cached) yes checking for GNU libc compatible malloc... (cached) yes @@ -1010,6 +1014,7 @@ checking for wchar_t... (cached) yes checking for wint_t... (cached) yes checking for mmap... (cached) yes checking for MAP_ANONYMOUS... yes +checking for pthread_atfork... yes checking for useconds_t... yes checking whether usleep allows large arguments... yes checking for a traditional french locale... (cached) fr_FR @@ -1018,6 +1023,7 @@ checking for a traditional japanese loca checking for a transitional chinese locale... (cached) zh_CN.GB18030 checking whether wctob works... yes checking whether wctob is declared... (cached) yes +checking for sched_yield in -lrt... yes checking for library containing strerror... none required checking for function prototypes... yes checking for string.h... (cached) yes From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 22 11:16:15 2010 Received: (at 7073) by debbugs.gnu.org; 22 Sep 2010 15:16:15 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyR3O-000247-T2 for submit@debbugs.gnu.org; Wed, 22 Sep 2010 11:16:15 -0400 Received: from mo-p00-ob.rzone.de ([81.169.146.161]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyR3M-000242-IN for 7073@debbugs.gnu.org; Wed, 22 Sep 2010 11:16:14 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1285168726; l=5211; s=domk; d=haible.de; h=Content-Transfer-Encoding:Content-Type:MIME-Version:In-Reply-To: References:Cc:Date:Subject:To:From:X-RZG-CLASS-ID:X-RZG-AUTH; bh=DdeG6bvA2DApcX6LglOPnLyMIxs=; b=yYQfQiAtSDegG2o+8i2jH38kkC4AuWGzQhAikiYCllvOeIKKw7wfq/+tZl7TPAD2oxn UqdOzuRC5g2OB6QLV+NbCLTLfhGLOFj8zqs2BEs3HqSAXXh/JyagYTpaf1Rmunvs78ssv 867E7cmLuzFguPWoVFiYgIe07TBC1+PHgL4= X-RZG-AUTH: :Ln4Re0+Ic/6oZXR1YgKryK8brksyK8dozXDwHXjf9hj/zDJRaPAi/IaFpUs= X-RZG-CLASS-ID: mo00 Received: from linuix.haible.de (dslb-088-069-164-180.pools.arcor-ip.net [88.69.164.180]) by post.strato.de (fruni mo62) (RZmta 23.5) with ESMTP id v0251fm8MEVxBa ; Wed, 22 Sep 2010 17:18:45 +0200 (MEST) From: Bruno Haible To: Paul Eggert Subject: Re: threadlib vs. pthread modules Date: Wed, 22 Sep 2010 17:18:43 +0200 User-Agent: KMail/1.9.9 References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <201009211940.46115.bruno@clisp.org> <4C98FFF8.805@cs.ucla.edu> In-Reply-To: <4C98FFF8.805@cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201009221718.45160.bruno@clisp.org> X-Spam-Score: -3.8 (---) X-Debbugs-Envelope-To: 7073 Cc: bug-coreutils@gnu.org, bug-gnulib@gnu.org, 7073@debbugs.gnu.org, "Gary V. Vaughan" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.7 (---) Hi Paul, > > You can do so by inserting > > gl_use_threads_default=no > > in your configure.ac, before the invocations of gl_INIT_EARLY and gl_INIT. > > Thanks, I didn't know that. I tried it ... > Also, it'd be helpful to document gl_use_threads_default. Well, I did not know about it either, before you asked ;-) But it's more future-proof to ask coreutils to define a particular macro, rather than to set a specific variable to a specific value. The same approach as we already use in m4/ansi-c++.m4. I'm changing threadlib.m4 as below. > and found one minor glitch. > "configure" said "checking for multithread API to use... no" > which might imply to the casual reader that the resulting coreutils > would not use multiple threads anywhere. How about appending > "within threadlib" to that message? > - AC_MSG_CHECKING([for multithread API to use]) > + AC_MSG_CHECKING([for multithread API to use within threadlib]) It's peculiar to coreutils that it uses both 'threadlib' and 'pthread'. For other packages, like gettext, the change that you suggest would be misleading. Therefore I think it should better be done in a local override of m4/threadlib.m4 in coreutils (via a tiny .diff file). > diff --git a/modules/gettext b/modules/gettext > index cab538e..787f237 100644 > --- a/modules/gettext > +++ b/modules/gettext > @@ -38,6 +38,13 @@ gettext-h > havelib > > configure.ac: > +# If your applications do not need gnulib to be multithread-safe, > +# either because they don't use threads or because they carefully > +# control which APIs are invoked while concurrent threads are running, > +# then you can avoid some build-time hassles and run-time overhead by > +# inserting: > +# gl_use_threads_default=no > +# early in configure.ac, before the invocations of gl_INIT_EARLY and gl_INIT. > AM_GNU_GETTEXT([external]) > AM_GNU_GETTEXT_VERSION([0.18.1]) > I don't see what this has to do with the gettext module. This belongs only in the threadlib module. A general throught about the 'threadlib' vs. 'pthread' modules: - The modules 'lock', 'tls', 'cond', 'thread', 'yield' attempt broad portability. They work well on MacOS X, mingw (even without pthreads-win32), Tru64, old Solaris, and others. But it does not provide the POSIX API. - The module 'pthread' provides the POSIX API, but don't work on older Unix systems nor mingw. I imagine a way to get the best of both is to change the API of 'lock', 'tls', 'cond', 'thread', 'yield' so that it provides a nearly POSIX API. I say "nearly", because for the locks, it will make things much easier to have separate functions for recursive locks that for normal locks/mutexes. And a similar difference will probably remain with pthread_key_t - this type does not provide enough information when threads are turned off. Would you (in coreutils, sort) be willing to use such an API that is slightly different from POSIX, but much closer to POSIX than 'lock', 'tls', 'cond', 'thread', 'yield' are now? 2010-09-22 Bruno Haible threadlib: Allow the package to change the default to 'no'. * m4/threadlib.m4 (gl_THREADLIB_EARLY_BODY): When gl_THREADLIB_DEFAULT_NO is defined, change the default to 'no'. Reported by Paul Eggert. --- m4/threadlib.m4.orig Wed Sep 22 16:55:58 2010 +++ m4/threadlib.m4 Wed Sep 22 16:54:17 2010 @@ -1,4 +1,4 @@ -# threadlib.m4 serial 6 (gettext-0.18.2) +# threadlib.m4 serial 7 (gettext-0.18.2) dnl Copyright (C) 2005-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,6 +9,11 @@ dnl gl_THREADLIB dnl ------------ dnl Tests for a multithreading library to be used. +dnl If the configure.ac contains a definition of the gl_THREADLIB_DEFAULT_NO +dnl (it must be placed before the invocation of gl_THREADLIB_EARLY!), then the +dnl default is 'no', otherwise it is system dependent. In both cases, the user +dnl can change the choice through the options --enable-threads=choice or +dnl --disable-threads. dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS, dnl USE_PTH_THREADS, USE_WIN32_THREADS dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use @@ -44,10 +49,12 @@ [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], [AC_REQUIRE([AC_GNU_SOURCE])]) dnl Check for multithreading. - m4_divert_text([DEFAULTS], [gl_use_threads_default=]) + m4_ifdef([gl_THREADLIB_DEFAULT_NO], + [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])], + [m4_divert_text([DEFAULTS], [gl_use_threads_default=])]) AC_ARG_ENABLE([threads], -AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API]) -AC_HELP_STRING([--disable-threads], [build without multithread safety]), +AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [ +AC_HELP_STRING([--disable-threads], [build without multithread safety])]), [gl_use_threads=$enableval], [if test -n "$gl_use_threads_default"; then gl_use_threads="$gl_use_threads_default" From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 22 13:46:45 2010 Received: (at submit) by debbugs.gnu.org; 22 Sep 2010 17:46:46 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyTP2-00037l-VH for submit@debbugs.gnu.org; Wed, 22 Sep 2010 13:46:45 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyTP0-00037g-V4 for submit@debbugs.gnu.org; Wed, 22 Sep 2010 13:46:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OyTRT-0007uS-WB for submit@debbugs.gnu.org; Wed, 22 Sep 2010 13:49:18 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:57751) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyTRQ-0007tI-Fy for submit@debbugs.gnu.org; Wed, 22 Sep 2010 13:49:15 -0400 Received: from [140.186.70.92] (port=39374 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OyTRM-0006zm-T9 for bug-coreutils@gnu.org; Wed, 22 Sep 2010 13:49:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OyTR9-0007r1-Mw for bug-coreutils@gnu.org; Wed, 22 Sep 2010 13:48:57 -0400 Received: from kiwi.cs.ucla.edu ([131.179.128.19]:62272) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyTR9-0007qr-D3; Wed, 22 Sep 2010 13:48:55 -0400 Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id o8MHmgb3022560; Wed, 22 Sep 2010 10:48:43 -0700 (PDT) Message-ID: <4C9A417A.9090307@cs.ucla.edu> Date: Wed, 22 Sep 2010 10:48:42 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 MIME-Version: 1.0 To: Bruno Haible Subject: Re: threadlib vs. pthread modules References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <201009211940.46115.bruno@clisp.org> <4C98FFF8.805@cs.ucla.edu> <201009221718.45160.bruno@clisp.org> In-Reply-To: <201009221718.45160.bruno@clisp.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.1 (-----) X-Debbugs-Envelope-To: submit Cc: bug-coreutils@gnu.org, bug-gnulib@gnu.org, 7073@debbugs.gnu.org, "Gary V. Vaughan" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.1 (-----) On 09/22/10 08:18, Bruno Haible wrote: > Would you (in coreutils, sort) be willing to use such an API that is > slightly different from POSIX, but much closer to POSIX than > 'lock', 'tls', 'cond', 'thread', 'yield' are now? Yes, that sounds like a better option, thanks! Two further thoughts. First, for coreutils there's no need to implement the POSIX API for recursive locks and for pthread_key_t, since coreutils doesn't need those features. That is, instead of supplying a superset of a subset of POSIX pthreads, it'd be fine to support just a subset of POSIX pthreads. If other applications need features where the POSIX API is hard to support portably, we can worry about those features later (perhaps never :-). I'd rather that coreutils didn't have to deal with any hassles in supporting pthreads features it doesn't need. Perhaps harder-to-support API features could be put into new modules, that the pthread module would be a prerequisite for. If it helps to simplify the work, here are the only pthread.h features that coreutils needs: pthread_t, pthread_cond_t, pthread_mutex_t, pthread_spinlock_t pthread_create/join/destroy pthread_spin_init/lock/unlock/destroy pthread_cond_init/signal/wait/destroy pthread_mutex_init/lock/unlock/destroy All spinlocks are created with PTHREAD_PROCESS_PRIVATE; all other objects are created with default attributes. Currently, on hosts that have other pthreads features but not spinlocks, spinlocks are emulated with mutexes. Second, suppose we want to support coreutils' preference, of using POSIX threads in sort, while not making the other gnulib functions be thread-safe, because we know that 'sort' (and other coreutils apps, of course) never invoke these gnulib functions from competing threads. I assume gl_THREADLIB_DEFAULT_NO wouldn't be enough to support this need, because it would shut off all threading, even in 'sort'. So it'd be nice to have a way to support this need, too. From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 30 01:35:45 2018 Received: (at 7073) by debbugs.gnu.org; 30 Oct 2018 05:35:45 +0000 Received: from localhost ([127.0.0.1]:53106 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHMgr-0008WN-Hl for submit@debbugs.gnu.org; Tue, 30 Oct 2018 01:35:45 -0400 Received: from mail-io1-f42.google.com ([209.85.166.42]:34303) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHMgp-0008W5-LN for 7073@debbugs.gnu.org; Tue, 30 Oct 2018 01:35:44 -0400 Received: by mail-io1-f42.google.com with SMTP id d80-v6so6528593iof.1 for <7073@debbugs.gnu.org>; Mon, 29 Oct 2018 22:35:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=2XNhc89sg0xW306ec5EbhVxRTIZHlL5Zs1qFTm1E1lI=; b=aVNkjG0S6xmtjuRpv8MXTXpJjnM+PTvXttOozKSIM2rZYE9huwb2lE+LFvx6P0JKXU mU7RVFP1augDeSUCMHQuEs68Lh//cVgrGgs3zzlWCbaPi0CNl8k+okCeoNvELknMHBVA unUZw8ryWWo8gkotSAOo3zIRTO+HpYFB1EuZae2pbHGlTT897Y/Bv0iBXrIeTT6JnRcg /iv8sPNnKAkH/lQmA4G6+MY3URUTBrkP1nc1HDHHy9VBkepOplw6Nkfv7F7gAkybACUS iO0TuGJ0CnQXgg9hNC1MaASF1mBCKa+ZEyRtVjoj1CxXP0UXKLCGr+XW9kuOnV+m6AOJ YwSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=2XNhc89sg0xW306ec5EbhVxRTIZHlL5Zs1qFTm1E1lI=; b=QxS2HnS2pPrr++bg8q3ifDqwZ3nBH7T8+hwkKfhf+b6cDV/0vNwlabqDttyHeu6+yf ZOxgZM5628kQw1p8gc4JscVcwtud6X7vRKihFcXQ9Io8oucCShD4rbuUwMjnY/danwKb zrsDnzm6bbjz0mWKEGlIyRhfyJvhUEQiTog0TKyan3UBNm0ocRyrXZtji6oG/56WXyDN mCq7s7syNsMS5yLcM664hZ8ZRW4IqWBUO0NSumEq19P3yBsiMFov65lENd4XCvI32thJ xhz93eSlMLUen/Le3I2JGyaKWTTvpdu7lmFYsDDMhPklsN8jHU2x7ZcCsr1mXYqY3abZ RzHw== X-Gm-Message-State: AGRZ1gJKqv8ycxfIgFWkw/VUE80k61Y44Ocj4ErV3MIfbMfjs8XYlKzP sc1kGUZLw5ajxBlUURoUE4p2dhM+FH0= X-Google-Smtp-Source: AJdET5epx3jNf1+HFzJvB949uZFHQH/qidNr9WFNqiPMHQZm1rsPPPCdNyMfzbZHWieU0rcJLAGqCw== X-Received: by 2002:a6b:d50d:: with SMTP id m13-v6mr11018106iog.152.1540877737388; Mon, 29 Oct 2018 22:35:37 -0700 (PDT) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id y11-v6sm7692181ioa.24.2018.10.29.22.35.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Oct 2018 22:35:35 -0700 (PDT) Subject: Re: bug#7073: threadlib vs. pthread modules To: Paul Eggert , Bruno Haible , 7073@debbugs.gnu.org References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <201009211940.46115.bruno@clisp.org> <4C98FFF8.805@cs.ucla.edu> <201009221718.45160.bruno@clisp.org> <4C9A417A.9090307@cs.ucla.edu> From: Assaf Gordon Message-ID: Date: Mon, 29 Oct 2018 23:35:29 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <4C9A417A.9090307@cs.ucla.edu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 7073 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) (triaging old bugs) Hello, This thread ( https://bugs.gnu.org/7073 ) starts with build error on Mac OS X due to pthread related issues. It then deals with this (already commited) gnulib change: ===== 2010-09-22 Bruno Haible threadlib: Allow the package to change the default to 'no'. * m4/threadlib.m4 (gl_THREADLIB_EARLY_BODY): When gl_THREADLIB_DEFAULT_NO is defined, change the default to 'no'. ===== And finally: On 2010-09-22 11:48 a.m., Paul Eggert wrote: > On 09/22/10 08:18, Bruno Haible wrote: > >> Would you (in coreutils, sort) be willing to use such an API that is >> slightly different from POSIX, but much closer to POSIX than >> 'lock', 'tls', 'cond', 'thread', 'yield' are now? > > Yes, that sounds like a better option, thanks! Two further thoughts. > Can this bug be closed? (at least - I believe newer coreutils builds fine on newer Mac OS X) thanks! - assaf From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 30 05:29:35 2018 Received: (at 7073) by debbugs.gnu.org; 30 Oct 2018 09:29:35 +0000 Received: from localhost ([127.0.0.1]:53375 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHQL9-0007qj-Ek for submit@debbugs.gnu.org; Tue, 30 Oct 2018 05:29:35 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([85.215.255.23]:25604) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHQL7-0007qa-7U for 7073@debbugs.gnu.org; Tue, 30 Oct 2018 05:29:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1540891771; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=yrAqLoXDesNTyYJGQW0m6MvA6M206ENIWMQWttpcto8=; b=RtfwVzYAAjlPPhuvC2PUYXDitfdAQlnJOPOIe0R8SKl6oiMSiMP2DfTKoo1ylnIWZf 8MBGtJli0yvGF74Ux6K1OtuZwkf/fu53+PXELRAAWVv+6OaHWuf6tiOP5t2BSmBLLw7f VNs9C2vlDhsgC1ThLS7PLguf7xPK87YawwRpe3GqnJ7EQh/556Pq6Bot10l0IRQ/TDJY NUEmYQCTkeOEoBzwCyIzeq2wuex7Zrxm4FVX0DFYZ2Ej/I6z7/pysY+ghBjLkfdsx98f r2Wsgx+ZYEt6XtCBP8Zfk5IUiLC7xk4PDmEQIxb2isxcMIVy/ufgc9KRX3AZ/7dxSgdt 77gQ== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOHqf9yfs=" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 44.3 DYNA|AUTH) with ESMTPSA id x0098du9U9TU6Do (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Tue, 30 Oct 2018 10:29:30 +0100 (CET) From: Bruno Haible To: Assaf Gordon Subject: Re: bug#7073: threadlib vs. pthread modules Date: Tue, 30 Oct 2018 10:29:30 +0100 Message-ID: <2155330.GGqhtgtY82@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-137-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: References: <4BDC804B-8745-46E2-A471-4C98EF8F580F@gnu.org> <4C9A417A.9090307@cs.ucla.edu> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 7073 Cc: Paul Eggert , 7073@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > Can this bug be closed? > (at least - I believe newer coreutils builds fine on newer Mac OS X) Yes. In my understanding, there is no issue between coreutils and gnulib's threadlib and pthread modules any more. Bruno From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 06 12:54:49 2018 Received: (at control) by debbugs.gnu.org; 6 Nov 2018 17:54:50 +0000 Received: from localhost ([127.0.0.1]:37656 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gK5Yv-0002WZ-J2 for submit@debbugs.gnu.org; Tue, 06 Nov 2018 12:54:49 -0500 Received: from mail-pf1-f177.google.com ([209.85.210.177]:40301) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gK5Yt-0002WM-S3 for control@debbugs.gnu.org; Tue, 06 Nov 2018 12:54:48 -0500 Received: by mail-pf1-f177.google.com with SMTP id x2-v6so2366031pfm.7 for ; Tue, 06 Nov 2018 09:54:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:message-id:date:user-agent:mime-version:content-language :content-transfer-encoding; bh=w9d/08qFC5Ts7NhGr63jWmWeo5A6OWt0s+9GMvzuiMI=; b=cO+mh+Hr89FVS3LSLGshuaOfUYoArRH9W4U3s/3+0ZPv+fqUFFyJP7ruDB4MjMkFpG ZwGENIpP0MDLTkGGw3za1+WtCptsvyfacCYJ0bOAVfta7otgxyZNs8/8tr6AtSDKuGFY Y8YtThvEFdPcKqz0F718Tr5bY14cCO8XcbxVQfpVlfNvipU/33vyAW5DNUVdy40yZnx7 yZgYRnclKusgylkSGqdcInfsM2HisFC8zJbL17E3zESdp8TrkGjmncVUL/br0hFKsgyd PRRkS4zExIzbEcG+Iu1unflPPNrfQ8n5VVHHOKJb6llzxRSioHUoR8g7y6ANH4NiX3/n iFXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=w9d/08qFC5Ts7NhGr63jWmWeo5A6OWt0s+9GMvzuiMI=; b=mWF5NxI2Upc1XNmAKzwGVqW/at8D/4b23TF5g6YZYdH1hnfC4iY6jcI3eYpaQ0SU4B NjfbiVlSk74gqD8s3alVP8Hb93AA0SkpquD19Q/bmLDgvPPg2zLH/qzZ/fV/JqByMW9V IUEcFXQZ0Y6DRbTkBwiBY+fZQUYjoyq6UhHlFy0RMd+fgpivlMSPRi+rJTch+SyyMKQJ Vf3kXmO9VHhLXkN1rz3u3Mg9wSVMNg3sYYOH92lJXRXhjvAId1GYjXiUSL3mzhjZIb+B ZJxcO8hCd4nbyX/3iVdCOiqOYFJggzktDjRPnqFxCQcdbWvQsl85BWtodOU+lkbHwqNj kaeA== X-Gm-Message-State: AGRZ1gLbkwThztCRqX09lrHXEpxjwxmSqZ08/YrnNEPi4ixotW4yKX05 FPYYQZF1XbQ8O0QZix4ygDeaVWPj X-Google-Smtp-Source: AJdET5cewFbSbvS2+Af/JdO/kyFgHrDvXH2abmTAlmR8Ir9wp2ce8mUDNiGGgmNPvyxatckH6pW1gw== X-Received: by 2002:a63:608f:: with SMTP id u137mr24638864pgb.203.1541526881535; Tue, 06 Nov 2018 09:54:41 -0800 (PST) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id o27-v6sm65894226pfk.85.2018.11.06.09.54.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 09:54:40 -0800 (PST) To: control@debbugs.gnu.org From: Assaf Gordon Message-ID: <2b8001e3-dc06-d9bd-22af-0893e4c8e41b@gmail.com> Date: Tue, 6 Nov 2018 10:54:39 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: close 7073 [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.210.177 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (assafgordon[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.210.177 listed in wl.mailspike.net] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) close 7073 From unknown Mon Jun 23 05:57:10 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 05 Dec 2018 12:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator