Commit 45bd53be authored by Erick Gallesio's avatar Erick Gallesio

CFLAGS adapation when using threads

parent 5e7d7c3b
2006-04-15 Erick Gallesio <eg@essi.fr> 2006-04-15 Erick Gallesio <eg@essi.fr>
* configure.in: Added the _REENTRANT and GC_LINUX_THREADS in the
CFLAGS for Linux, when using threads for the GC.
* src/fport.c, src/system.c * src/fport.c, src/system.c
* lib/repl.stk (main-repl): Changed the way buffer are flushed. * lib/repl.stk (main-repl): Changed the way buffer are flushed.
Bonus: when programs exits normally in interactive mode, the Bonus: when programs exits normally in interactive mode, the
......
...@@ -3801,6 +3801,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu ...@@ -3801,6 +3801,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
case "$THREADS" in case "$THREADS" in
no | none | single) no | none | single)
THREADS=none THREADS=none
...@@ -4168,6 +4169,16 @@ echo "$as_me: error: Unknown thread system: $THREADS" >&2;} ...@@ -4168,6 +4169,16 @@ echo "$as_me: error: Unknown thread system: $THREADS" >&2;}
;; ;;
esac esac
case "$THREADS" in
none) true ;;
*) case `uname -s` in
Linux*) CFLAGS="$CFLAGS -D_REENTRANT=1 -DGC_LINUX_THREADS=1";;
esac
esac
if test "$THREADS" = pthreads; then if test "$THREADS" = pthreads; then
PTHREADS_TRUE= PTHREADS_TRUE=
...@@ -4437,7 +4448,7 @@ if test "${with_provided_gc+set}" = set; then ...@@ -4437,7 +4448,7 @@ if test "${with_provided_gc+set}" = set; then
HAVE_GC="no" HAVE_GC="no"
fi; fi;
# On Mac OS X use the given GC (tio compile it without -Ox) # On Mac OS X use the given GC (to compile it without -Ox)
case `uname -s` in case `uname -s` in
Darwin*) echo "Force '--with-provided-gc' on MacOS"; Darwin*) echo "Force '--with-provided-gc' on MacOS";
HAVE_GC="no" ;; HAVE_GC="no" ;;
......
...@@ -2,7 +2,7 @@ dnl configure.in for STklos ...@@ -2,7 +2,7 @@ dnl configure.in for STklos
dnl dnl
dnl Author: Erick Gallesio [eg@unice.fr] dnl Author: Erick Gallesio [eg@unice.fr]
dnl Creation date: 28-Dec-1999 21:19 (eg) dnl Creation date: 28-Dec-1999 21:19 (eg)
dnl Last file update: 15-Apr-2006 11:17 (eg) dnl Last file update: 15-Apr-2006 12:44 (eg)
AC_INIT(src/stklos.c) AC_INIT(src/stklos.c)
...@@ -73,6 +73,7 @@ AC_DEFUN(GC_CHECK_DEFINE, [ ...@@ -73,6 +73,7 @@ AC_DEFUN(GC_CHECK_DEFINE, [
[$3], [$4]) [$3], [$4])
]) ])
dnl Now look at what threads we want dnl Now look at what threads we want
case "$THREADS" in case "$THREADS" in
no | none | single) no | none | single)
...@@ -106,6 +107,17 @@ case "$THREADS" in ...@@ -106,6 +107,17 @@ case "$THREADS" in
AC_MSG_ERROR([Unknown thread system: $THREADS]) AC_MSG_ERROR([Unknown thread system: $THREADS])
;; ;;
esac esac
dnl Add the options _REENTRANT and GC_LINUX_THREADS if we are on Linux
case "$THREADS" in
none) true ;;
*) case `uname -s` in
Linux*) CFLAGS="$CFLAGS -D_REENTRANT=1 -DGC_LINUX_THREADS=1";;
esac
esac
dnl Automake nightmare dnl Automake nightmare
AM_CONDITIONAL(PTHREADS, test "$THREADS" = pthreads) AM_CONDITIONAL(PTHREADS, test "$THREADS" = pthreads)
AM_CONDITIONAL(LURC, test "$THREADS" = lurc) AM_CONDITIONAL(LURC, test "$THREADS" = lurc)
...@@ -141,7 +153,7 @@ AC_ARG_WITH(provided-gc, ...@@ -141,7 +153,7 @@ AC_ARG_WITH(provided-gc,
[ --with-provided-gc use our GC version even the system provides one], [ --with-provided-gc use our GC version even the system provides one],
HAVE_GC="no") HAVE_GC="no")
# On Mac OS X use the given GC (tio compile it without -Ox) # On Mac OS X use the given GC (to compile it without -Ox)
case `uname -s` in case `uname -s` in
Darwin*) echo "Force '--with-provided-gc' on MacOS"; Darwin*) echo "Force '--with-provided-gc' on MacOS";
HAVE_GC="no" ;; HAVE_GC="no" ;;
......
...@@ -21,12 +21,9 @@ ...@@ -21,12 +21,9 @@
* *
* Author: Erick Gallesio [eg@essi.fr] * Author: Erick Gallesio [eg@essi.fr]
* Creation date: 2-Feb-2006 21:58 (eg) * Creation date: 2-Feb-2006 21:58 (eg)
* Last file update: 8-Feb-2006 10:24 (eg) * Last file update: 15-Apr-2006 13:05 (eg)
*/ */
#define _REENTRANT 1
#define GC_LINUX_THREADS 1
#include <lurc.h> #include <lurc.h>
#ifdef LURC_ENABLE_PTHREAD #ifdef LURC_ENABLE_PTHREAD
......
...@@ -21,12 +21,9 @@ ...@@ -21,12 +21,9 @@
* *
* Author: Erick Gallesio [eg@essi.fr] * Author: Erick Gallesio [eg@essi.fr]
* Creation date: 2-Feb-2006 21:58 (eg) * Creation date: 2-Feb-2006 21:58 (eg)
* Last file update: 6-Apr-2006 19:16 (eg) * Last file update: 15-Apr-2006 13:06 (eg)
*/ */
#define _REENTRANT 1
#define GC_LINUX_THREADS 1
#include <unistd.h> #include <unistd.h>
#include "stklos.h" #include "stklos.h"
#include "vm.h" #include "vm.h"
......
...@@ -32,8 +32,6 @@ extern "C" ...@@ -32,8 +32,6 @@ extern "C"
{ {
#endif #endif
#define STK_USE_PTHREADS 1
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
......
...@@ -21,13 +21,10 @@ ...@@ -21,13 +21,10 @@
* *
* Author: Erick Gallesio [eg@essi.fr] * Author: Erick Gallesio [eg@essi.fr]
* Creation date: 23-Jan-2006 12:14 (eg) * Creation date: 23-Jan-2006 12:14 (eg)
* Last file update: 15-Apr-2006 00:16 (eg) * Last file update: 15-Apr-2006 13:06 (eg)
*/ */
#define _REENTRANT 1
#define GC_LINUX_THREADS 1
#include <unistd.h> #include <unistd.h>
#include "stklos.h" #include "stklos.h"
#include "vm.h" #include "vm.h"
......
...@@ -21,15 +21,11 @@ ...@@ -21,15 +21,11 @@
* *
* Author: Erick Gallesio [eg@essi.fr] * Author: Erick Gallesio [eg@essi.fr]
* Creation date: 4-Feb-2006 11:03 (eg) * Creation date: 4-Feb-2006 11:03 (eg)
* Last file update: 12-Apr-2006 23:24 (eg) * Last file update: 15-Apr-2006 13:06 (eg)
*/ */
#ifndef _STK_THREAD_H #ifndef _STK_THREAD_H
#define _STK_THREAD_H #define _STK_THREAD_H
//FIX:
#define _REENTRANT 1
#define GC_LINUX_THREADS 1
#include <pthread.h> #include <pthread.h>
enum thread_state { th_new, th_runnable, th_terminated, th_blocked}; enum thread_state { th_new, th_runnable, th_terminated, th_blocked};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment