From 0d4c7a1323106c6e60511bef929048edcb040205 Mon Sep 17 00:00:00 2001 From: Gabor Melis Date: Mon, 16 Feb 2009 22:08:38 +0000 Subject: [PATCH] 1.0.25.42: make os_thread 0 on unithread builds ... 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 | 6 ++++-- src/runtime/gencgc.c | 2 +- src/runtime/runtime.h | 6 +++--- src/runtime/thread.c | 10 ++++------ version.lisp-expr | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/code/target-thread.lisp b/src/code/target-thread.lisp index 015ebd1..3884f95 100644 --- a/src/code/target-thread.lisp +++ b/src/code/target-thread.lisp @@ -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") diff --git a/src/runtime/gencgc.c b/src/runtime/gencgc.c index 81ef8b2..5e5620f 100644 --- a/src/runtime/gencgc.c +++ b/src/runtime/gencgc.c @@ -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), diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h index 9f38dab..01f4031 100644 --- a/src/runtime/runtime.h +++ b/src/runtime/runtime.h @@ -16,14 +16,14 @@ #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 diff --git a/src/runtime/thread.c b/src/runtime/thread.c index ebdafaa..bcc470c 100644 --- a/src/runtime/thread.c +++ b/src/runtime/thread.c @@ -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 } diff --git a/version.lisp-expr b/version.lisp-expr index 40e6205..d293415 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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" -- 1.7.10.4