dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
dnl 02110-1301, USA.
dnl
-dnl $Id: configure.ac 7966 2007-05-25 12:41:03Z pm $
+dnl $Id: configure.ac 7996 2007-05-31 23:05:51Z twisti $
dnl Process this file with autoconf to produce a configure script.
dnl keep them alpha-sorted!
AC_CHECK_HEADERS([fcntl.h])
+AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([string.h])
AC_CHECK_HEADERS([time.h])
AC_CHECK_HEADERS([unistd.h])
dnl keep them alpha-sorted!
AC_CHECK_FUNCS([calloc])
+AC_CHECK_FUNCS([confstr])
AC_CHECK_FUNCS([getpagesize])
AC_CHECK_FUNCS([free])
AC_CHECK_FUNCS([getcwd])
AC_CHECK_FUNCS([mprotect])
AC_CHECK_FUNCS([scandir])
AC_CHECK_FUNCS([strdup])
+AC_CHECK_FUNCS([strstr])
AC_CHECK_FUNCS([time])
--- /dev/null
+dnl m4/ac_pthreads_implementation.m4
+dnl
+dnl Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel,
+dnl C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
+dnl E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
+dnl J. Wenninger, Institut f. Computersprachen - TU Wien
+dnl
+dnl This file is part of CACAO.
+dnl
+dnl This program is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU General Public License as
+dnl published by the Free Software Foundation; either version 2, or (at
+dnl your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+dnl 02110-1301, USA.
+dnl
+dnl $Id: configure.ac 7228 2007-01-19 01:13:48Z edwin $
+
+
+dnl checks if the pthreads implementation is NPTL or LinuxThreads
+
+AC_DEFUN([AC_CHECK_PTHREADS_IMPLEMENTATION],
+[
+ AC_MSG_CHECKING(pthread implementation)
+ AC_TRY_RUN(
+[
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+int main(void)
+{
+ char *pathbuf;
+ size_t n;
+
+ /* _CS_GNU_LIBPTHREAD_VERSION (GNU C library only; since glibc 2.3.2) */
+ /* If the glibc is a pre-2.3.2 version, the compilation fails and we
+ fall back to linuxthreads. */
+
+ n = confstr(_CS_GNU_LIBPTHREAD_VERSION, NULL, (size_t) 0);
+
+ pathbuf = malloc(n);
+ if ((pathbuf = malloc(n)) == NULL) abort();
+ (void) confstr(_CS_GNU_LIBPTHREAD_VERSION, pathbuf, n);
+
+ if (strstr(pathbuf, "linuxthreads") != NULL)
+ return 1;
+
+ return 0;
+}
+],
+[
+ AC_MSG_RESULT(NPTL)
+ AC_DEFINE(PTHREADS_IS_NPTL, 1, [NPTL pthreads implementation])
+],
+[
+ AC_MSG_RESULT(linuxthreads)
+ AC_DEFINE(PTHREADS_IS_LINUXTHREADS, 1, [LinuxThreads pthread implementation])
+])
+])
AC_DEFINE([ENABLE_THREADS], 1, [enable threads])
AC_CHECK_LIB(pthread, main)
+ dnl check for pthread implementation
+ case "${OS_DIR}" in
+ linux )
+ AC_CHECK_PTHREADS_IMPLEMENTATION
+ ;;
+ esac
+
ARCH_CFLAGS="$ARCH_CFLAGS -D_REENTRANT"
dnl we changed ARCH_CFLAGS, set CFLAGS again
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: signal.c 7995 2007-05-31 22:45:19Z twisti $
+ $Id: signal.c 7996 2007-05-31 23:05:51Z twisti $
*/
assert(OFFSET(java_bytearray, data) > EXCEPTION_HARDWARE_PATCHER);
+#if !defined(PTHREADS_IS_LINUXTHREADS)
+ /* XXX Remove this #ifdef with exact-GC. */
+
/* Block the following signals (SIGINT for <ctrl>-c, SIGQUIT for
<ctrl>-\). We enable them later in signal_thread, but only for
this thread. */
if (sigprocmask(SIG_BLOCK, &mask, NULL) != 0)
vm_abort("signal_init: sigprocmask failed: %s", strerror(errno));
+#endif
#if defined(ENABLE_GC_BOEHM)
/* Allocate something so the garbage collector's signal handlers
static void signal_thread(void)
{
- sigset_t mask;
- int sig;
+ threadobject *t;
+ sigset_t mask;
+ int sig;
+
+ t = THREADOBJECT;
if (sigemptyset(&mask) != 0)
vm_abort("signal_thread: sigemptyset failed: %s", strerror(errno));
but it seems to make problems with Boehm-GC. We should
revisit this code with our new exact-GC. */
+ threads_thread_state_waiting(t);
+
/* if (sigwait(&mask, &sig) != 0) */
/* vm_abort("signal_thread: sigwait failed: %s", strerror(errno)); */
(void) sigwait(&mask, &sig);
+ threads_thread_state_runnable(t);
+
switch (sig) {
case SIGINT:
/* exit the vm properly */
if (!recompile_init())
vm_abort("vm_create: recompile_init failed");
+#if !defined(PTHREADS_IS_LINUXTHREADS)
+ /* XXX Remove this #ifdef with exact-GC. */
+
/* start the signal handler thread */
if (!signal_start_thread())
vm_abort("vm_create: signal_start_thread failed");
+#endif
/* finally, start the finalizer thread */