Remove attempt to use C11 threads

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.
This commit is contained in:
Paul Eggert 2015-12-15 23:10:12 -08:00
parent 80346f1ae4
commit d8b4105705
2 changed files with 4 additions and 16 deletions

View 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

View 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,