From: <me...@us...> - 2005-08-09 18:46:13
|
Update of /cvsroot/sbcl/sbcl/src/runtime In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3934/src/runtime Modified Files: interrupt.c thread.c Log Message: 0.9.3.35: minor thread changes * reverted: thread state synchronization change in gc_start_the_world that did nothing but slowed things down * reverted: set the thread state to dead in C when things are really over not in lisp when more allocation can happen and confuse gc * gc_stop_the_world: yield the cpu when waiting for a thread to suspend Index: interrupt.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/interrupt.c,v retrieving revision 1.83 retrieving revision 1.84 diff -u -d -r1.83 -r1.84 --- interrupt.c 9 Aug 2005 13:57:51 -0000 1.83 +++ interrupt.c 9 Aug 2005 15:06:03 -0000 1.84 @@ -638,11 +638,10 @@ sigemptyset(&ss); sigaddset(&ss,SIG_STOP_FOR_GC); sigwaitinfo(&ss,0); - if(thread->state!=STATE_SUSPENDED) { + if(thread->state!=STATE_RUNNING) { lose("sig_stop_for_gc_handler: wrong thread state on wakeup: %ld\n", fixnum_value(thread->state)); } - thread->state=STATE_RUNNING; undo_fake_foreign_function_call(context); } Index: thread.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/thread.c,v retrieving revision 1.45 retrieving revision 1.46 diff -u -d -r1.45 -r1.46 --- thread.c 9 Aug 2005 13:57:52 -0000 1.45 +++ thread.c 9 Aug 2005 15:06:04 -0000 1.46 @@ -107,6 +107,7 @@ new_thread_trampoline(struct thread *th) { lispobj function; + int result; function = th->unbound_marker; th->unbound_marker = UNBOUND_MARKER_WIDETAG; if(arch_os_thread_init(th)==0) return 1; @@ -115,7 +116,9 @@ while(th->os_thread<1) sched_yield(); th->state=STATE_RUNNING; - return funcall0(function); + result = funcall0(function); + th->state=STATE_DEAD; + return result; } #endif /* LISP_FEATURE_SB_THREAD */ @@ -446,6 +449,8 @@ if((p==th) || (p->state==STATE_SUSPENDED) || (p->state==STATE_DEAD)) { p=p->next; + } else { + sched_yield(); } } FSHOW_SIGNAL((stderr,"/gc_stop_the_world:end\n")); @@ -468,17 +473,10 @@ } FSHOW_SIGNAL((stderr, "/gc_start_the_world: resuming %lu\n", p->os_thread)); + p->state=STATE_RUNNING; thread_kill(p->os_thread,SIG_STOP_FOR_GC); } } - /* we must wait for all threads to leave suspended state else we - * risk signal accumulation and lose any meaning of - * thread->state */ - for(p=all_threads;p;) { - if((p==th) || (p->state!=STATE_SUSPENDED)) { - p=p->next; - } - } release_spinlock(&all_threads_lock); FSHOW_SIGNAL((stderr,"/gc_start_the_world:end\n")); } |