1.0.25.42: make os_thread 0 on unithread builds
authorGabor Melis <mega@hotpop.com>
Mon, 16 Feb 2009 22:08:38 +0000 (22:08 +0000)
committerGabor Melis <mega@hotpop.com>
Mon, 16 Feb 2009 22:08:38 +0000 (22:08 +0000)
... because storing the pid there (two places really, thread.os_thread
and THREAD-OS-THREAD) complicates SB-POSIX:FORK, and makes a simple
fork() lose.

src/code/target-thread.lisp
src/runtime/gencgc.c
src/runtime/runtime.h
src/runtime/thread.c
version.lisp-expr

index 015ebd1..3884f95 100644 (file)
@@ -87,8 +87,10 @@ in future versions."
 
 (declaim (inline current-thread-os-thread))
 (defun current-thread-os-thread ()
-  (sap-int
-   (sb!vm::current-thread-offset-sap sb!vm::thread-os-thread-slot)))
+  #!+sb-thread
+  (sap-int (sb!vm::current-thread-offset-sap sb!vm::thread-os-thread-slot))
+  #!-sb-thread
+  0)
 
 (defun init-initial-thread ()
   (/show0 "Entering INIT-INITIAL-THREAD")
index 81ef8b2..5e5620f 100644 (file)
@@ -4749,7 +4749,7 @@ general_alloc_internal(long nbytes, int page_type_flag, struct alloc_region *reg
     if ((alloc_signal & FIXNUM_TAG_MASK) == 0) {
         if ((signed long) alloc_signal <= 0) {
             SetSymbolValue(ALLOC_SIGNAL, T, thread);
-            thread_kill(thread->os_thread, SIGPROF);
+            raise(SIGPROF);
         } else {
             SetSymbolValue(ALLOC_SIGNAL,
                            alloc_signal - (1 << N_FIXNUM_TAG_BITS),
index 9f38dab..01f4031 100644 (file)
 #define _SBCL_RUNTIME_H_
 
 #if defined(LISP_FEATURE_SB_THREAD)
-#define thread_self pthread_self
+#define thread_self() pthread_self()
 #define thread_kill pthread_kill
 #define thread_sigmask pthread_sigmask
 #define thread_mutex_lock(l) pthread_mutex_lock(l)
 #define thread_mutex_unlock(l) pthread_mutex_unlock(l)
 #else
-#define thread_self getpid
-#define thread_kill kill
+#define thread_self() 0
+#define thread_kill kill_safely
 #define thread_sigmask sigprocmask
 #define thread_mutex_lock(l) 0
 #define thread_mutex_unlock(l) 0
index ebdafaa..bcc470c 100644 (file)
@@ -713,16 +713,14 @@ kill_safely(os_thread_t os_thread, int signal)
         return -1;
 #else
     int status;
-    if (os_thread != getpid())
+    if (os_thread != 0)
         lose("kill_safely: who do you want to kill? %d?\n", os_thread);
-    status = kill(os_thread, signal);
+    status = raise(signal);
     if (status == 0) {
         return 0;
-    } else if (status == ESRCH) {
-        return -1;
     } else {
-        lose("cannot send signal %d to process %lu: %d, %s\n",
-             signal, os_thread, status, strerror(status));
+        lose("cannot raise signal %d, %d %s\n",
+             signal, status, strerror(errno));
     }
 #endif
 }
index 40e6205..d293415 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".)
-"1.0.25.41"
+"1.0.25.42"