0.8.20.30:
authorDaniel Barlow <dan@telent.net>
Tue, 22 Mar 2005 19:32:26 +0000 (19:32 +0000)
committerDaniel Barlow <dan@telent.net>
Tue, 22 Mar 2005 19:32:26 +0000 (19:32 +0000)
Slightly nicer behaviour on non-NPTL systems makes it possible
to use thread-enabled binaries in thread-unfriendly environments again
- but a warning is issued at startup and MAKE-THREAD signals an error

Remove some slightly odd-looking stuff in make-config.sh: once
again it is possible to "SBCL_ARCH=x86 sh make.sh" on an x86-64

NEWS
make-config.sh
src/code/target-thread.lisp
src/runtime/linux-os.c
src/runtime/thread.c
version.lisp-expr

diff --git a/NEWS b/NEWS
index c872529..9649fd2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,8 @@
 changes in sbcl-0.8.21 (0.9alpha.1?) relative to sbcl-0.8.20:
   * incompatible change: thread support for non-NPTL systems has
     been removed - locking is buggy and unreliable.  A threaded 
-    SBCL build will now refuse to start unless futex support is 
-    detected in the kernel
+    SBCL build will now warn at startup and refuse to create
+    new threads, unless futex support is detected in the kernel
   * incompatible change: the top level REPL now has only an ABORT
     restart associated with it, not TOPLEVEL and ABORT as it used to.
     TOP and TOPLEVEL are now available as debugger commands for 
index fe1981c..a8cad3f 100644 (file)
@@ -97,11 +97,7 @@ case `uname` in
     Linux)
        printf ' :linux' >> $ltf
        sbcl_os="linux"
-       if [ "`uname -m`" = "x86_64" ]; then
-           ln -s Config.x86_64-linux Config
-       else
-           ln -s Config.$sbcl_arch-linux Config
-       fi
+       ln -s Config.$sbcl_arch-linux Config
        ln -s $sbcl_arch-linux-os.h target-arch-os.h
        ln -s linux-os.h target-os.h
        ;;
index aedfa10..fe34aac 100644 (file)
@@ -185,6 +185,7 @@ time we reacquire LOCK and return to the caller."
                    (funcall real-function))
                  0))
              (values))))))
+    (when (zerop tid) (error "Can't create a new thread"))
     (with-mutex ((session-lock *session*))
       (pushnew tid (session-threads *session*)))
     tid))
index 077f441..669ae7c 100644 (file)
@@ -73,6 +73,7 @@ _syscall4(int,sys_futex,
 #include "gc.h"
 \f
 int linux_sparc_siginfo_bug = 0;
+int linux_no_threads_p = 0;
 
 void os_init(void)
 {
@@ -100,9 +101,9 @@ void os_init(void)
     }
 #ifdef LISP_FEATURE_SB_THREAD
     futex_wait(futex,-1);
-    if(errno==ENOSYS) {
-       lose("linux with NPTL support (e.g. kernel 2.6 or newer) required for thread-enabled SBCL");
-    }
+    if(errno==ENOSYS)  linux_no_threads_p = 1;
+    if(linux_no_threads_p) 
+       fprintf(stderr,"Linux with NPTL support (e.g. kernel 2.6 or newer) required for \nthread-enabled SBCL.  Disabling thread support.\n\n");
 #endif
     os_vm_page_size = getpagesize();
 }
index 43d551a..0f28c30 100644 (file)
@@ -28,6 +28,7 @@ int dynamic_values_bytes=4096*sizeof(lispobj);        /* same for all threads */
 struct thread *all_threads;
 volatile lispobj all_threads_lock;
 extern struct interrupt_data * global_interrupt_data;
+extern int linux_no_threads_p;
 
 int
 initial_thread_trampoline(struct thread *th)
@@ -230,9 +231,11 @@ void create_initial_thread(lispobj initial_function) {
 
 #ifdef LISP_FEATURE_SB_THREAD
 pid_t create_thread(lispobj initial_function) {
-    struct thread *th=create_thread_struct(initial_function);
+    struct thread *th;
     pid_t kid_pid=0;
 
+    if(linux_no_threads_p) return 0;
+    th=create_thread_struct(initial_function);
     if(th==0) return 0;
     kid_pid=clone(new_thread_trampoline,
                  (((void*)th->control_stack_start)+
index 90840e9..f56c083 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.8.20.29"
+"0.8.20.30"