0.8.3.87
authorDaniel Barlow <dan@telent.net>
Mon, 22 Sep 2003 23:01:13 +0000 (23:01 +0000)
committerDaniel Barlow <dan@telent.net>
Mon, 22 Sep 2003 23:01:13 +0000 (23:01 +0000)
After vast effort (mostly Christophe's) we have a fix for the
hangs in multithreaded CLX.  Under some circumstances we could
be trying to scavenge one thread's stack using the stack
pointer from another: needless to say, this is not too effective.

When sleeping on a queue, loop around sigwaitinfo restarting
it until it stops returning EINTR

src/runtime/gencgc.c
src/runtime/thread.c
version.lisp-expr

index 3a7dccb..4061ae6 100644 (file)
@@ -3687,10 +3687,12 @@ garbage_collect_generation(int generation, int raise)
      * handler, you will lose. */
     for_each_thread(th) {
        void **ptr;
-       void **esp= (void **) &raise;
+       void **esp=(void **)-1;
        int i,free;
 #ifdef LISP_FEATURE_SB_THREAD
-       if(th!=arch_os_get_current_thread()) {
+       if(th==arch_os_get_current_thread()) {
+           esp = (void **) &raise;
+       } else {
            void **esp1;
            free=fixnum_value(SymbolValue(FREE_INTERRUPT_CONTEXT_INDEX,th));
            for(i=free-1;i>=0;i--) {
@@ -3704,6 +3706,8 @@ garbage_collect_generation(int generation, int raise)
                }
            }
        }
+#else
+       esp = (void **) &raise;
 #endif
        for (ptr = (void **)th->control_stack_end; ptr > esp;  ptr--) {
            preserve_pointer(*ptr);
index 80be925..ebdb2e4 100644 (file)
@@ -3,6 +3,7 @@
 #include <sched.h>
 #include <signal.h>
 #include <stddef.h>
+#include <errno.h>
 #ifndef CLONE_PARENT           /* lameass glibc 2.2  doesn't define this */
 #define CLONE_PARENT 0x00008000        /* even though the manpage documents it */
 #endif
@@ -282,7 +283,10 @@ void unblock_sigcont_and_sleep(void)
     sigset_t set;
     sigemptyset(&set);
     sigaddset(&set,SIGCONT);
-    sigwaitinfo(&set,0);
+    do {
+       errno=0;
+       sigwaitinfo(&set,0);
+    }while(errno==EINTR);
     sigprocmask(SIG_UNBLOCK,&set,0);
 }
 
@@ -309,8 +313,8 @@ void gc_stop_the_world()
             * for them on each time around */
            for(p=all_threads;p!=tail;p=p->next) {
                if(p==th) continue;
-               countdown_to_gc++;
-               kill(p->pid,SIG_STOP_FOR_GC);
+               countdown_to_gc++;
+               kill(p->pid,SIG_STOP_FOR_GC);
            }
            tail=all_threads;
        } else {
index 351dffd..1a300b0 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.3.86"
+"0.8.3.87"