]> code.delx.au - gnu-emacs/commitdiff
Remove attempt to use C11 threads
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 16 Dec 2015 07:10:12 +0000 (23:10 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 16 Dec 2015 07:10:48 +0000 (23:10 -0800)
C11 threads are not needed for Emacs now, and their use is causing
hassles on FreeBSD 10.x.  Problem reported by Ashish SHUKLA in:
http://lists.gnu.org/archive/html/emacs-devel/2015-12/msg00648.html
* configure.ac: Do not check for C11 threads. Remove unnecessary
fiddling with CPPFLAGS when configuring pthreads.
* src/emacs-module.c (main_thread, check_main_thread)
(module_init): Do not worry about C11 threads.

configure.ac
src/emacs-module.c

index b2fa1eddaffb9babda6b31ee99fcecde22766aba..14a142805d9f7733b14aacd866c6927e6b2537a1 100644 (file)
@@ -2192,9 +2192,6 @@ LIBS="$LIBS_SYSTEM $LIBS"
 dnl FIXME replace main with a function we actually want from this library.
 AC_CHECK_LIB(Xbsd, main, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd")
 
-dnl Check for C11 threads.
-AC_CHECK_HEADERS_ONCE(threads.h)
-
 dnl Check for the POSIX thread library.
 LIB_PTHREAD=
 AC_CHECK_HEADERS_ONCE(pthread.h)
@@ -2202,7 +2199,6 @@ if test "$ac_cv_header_pthread_h" && test "$opsys" != "mingw32"; then
   AC_CACHE_CHECK([for pthread library],
     [emacs_cv_pthread_lib],
     [emacs_cv_pthread_lib=no
-     OLD_CPPFLAGS=$CPPFLAGS
      OLD_LIBS=$LIBS
      for emacs_pthread_lib in 'none needed' -lpthread; do
        case $emacs_pthread_lib in
@@ -2231,8 +2227,7 @@ if test "$ac_cv_header_pthread_h" && test "$opsys" != "mingw32"; then
        if test "$emacs_cv_pthread_lib" != no; then
         break
        fi
-     done
-     CPPFLAGS=$OLD_CPPFLAGS])
+     done])
   if test "$emacs_cv_pthread_lib" != no; then
     AC_DEFINE([HAVE_PTHREAD], 1, [Define to 1 if you have POSIX threads.])
     case $emacs_cv_pthread_lib in
index 620df930a4488e45611a246070bed4c518988b0a..ee976440985bba54d5ded27254fbb425899452f1 100644 (file)
@@ -44,10 +44,7 @@ enum { module_has_cleanup = false };
 
 /* Handle to the main thread.  Used to verify that modules call us in
    the right thread.  */
-#ifdef HAVE_THREADS_H
-# include <threads.h>
-static thrd_t main_thread;
-#elif defined HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 # include <pthread.h>
 static pthread_t main_thread;
 #elif defined WINDOWSNT
@@ -789,9 +786,7 @@ usage: (module-call ENVOBJ &rest ARGLIST)   */)
 static void
 check_main_thread (void)
 {
-#ifdef HAVE_THREADS_H
-  eassert (thrd_equal (thdr_current (), main_thread));
-#elif defined HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
   eassert (pthread_equal (pthread_self (), main_thread));
 #elif defined WINDOWSNT
   eassert (GetCurrentThreadId () == main_thread);
@@ -1125,9 +1120,7 @@ module_init (void)
 {
   /* It is not guaranteed that dynamic initializers run in the main thread,
      therefore detect the main thread here.  */
-#ifdef HAVE_THREADS_H
-  main_thread = thrd_current ();
-#elif defined HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
   main_thread = pthread_self ();
 #elif defined WINDOWSNT
   /* The 'main' function already recorded the main thread's thread ID,