[前][次][番号順一覧][スレッド一覧][生データ]

yarv-diff:293

From: ko1 atdot.net
Date: 21 Feb 2006 15:05:06 -0000
Subject: [yarv-diff:293] r457 - in trunk: . ext/win32ole

Author: ko1
Date: 2006-02-22 00:05:06 +0900 (Wed, 22 Feb 2006)
New Revision: 457

Modified:
   trunk/
   trunk/ChangeLog
   trunk/ext/win32ole/.document
   trunk/test.rb
   trunk/thread.c
   trunk/thread_pthread.h
Log:
 r700@lermite:  ko1 | 2006-02-22 00:04:03 +0900
 	* thread.c : fix synchornize return value ([yarv-dev:957])
 	and some synchornization error
 
 	* thread_pthread.h : add debug helper function
 



Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 81cd9672-7512-7e48-ae48-6936450e977d:/local/yarv/trunk:698
   + 81cd9672-7512-7e48-ae48-6936450e977d:/local/yarv/trunk:700

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-02-21 12:09:54 UTC (rev 456)
+++ trunk/ChangeLog	2006-02-21 15:05:06 UTC (rev 457)
@@ -4,6 +4,14 @@
 #  from Mon, 03 May 2004 01:24:19 +0900
 #
 
+2006-02-22(Wed) 00:02:08 +0900  Koichi Sasada  <ko1 atdot.net>
+
+	* thread.c : fix synchornize return value ([yarv-dev:957])
+	and some synchornization error
+
+	* thread_pthread.h : add debug helper function
+
+
 2006-02-21(Tue) 20:54:28 +0900  Koichi Sasada  <ko1 atdot.net>
 
 	* eval.c : fix place of rb_thread_terminate_all()

Modified: trunk/ext/win32ole/.document
===================================================================
--- trunk/ext/win32ole/.document	2006-02-21 12:09:54 UTC (rev 456)
+++ trunk/ext/win32ole/.document	2006-02-21 15:05:06 UTC (rev 457)
@@ -1 +0,0 @@
-win32ole.c

Modified: trunk/test.rb
===================================================================
--- trunk/test.rb	2006-02-21 12:09:54 UTC (rev 456)
+++ trunk/test.rb	2006-02-21 15:05:06 UTC (rev 457)
@@ -1,3 +1,12 @@
+require 'timeout'
+
+10000.times{
+  timeout(1){
+    Thread.pass
+  }
+}
+__END__
+
 at_exit do
   p :foo
   main = nil

Modified: trunk/thread.c
===================================================================
--- trunk/thread.c	2006-02-21 12:09:54 UTC (rev 456)
+++ trunk/thread.c	2006-02-21 15:05:06 UTC (rev 457)
@@ -119,8 +119,8 @@
 #define GVL_UNLOCK_RANGE(exec) do { \
     yarv_thread_t *__th = GET_THREAD(); \
     int __prev_status = __th->status; \
+    YARV_CHECK_INTS(); \
     __th->status = THREAD_STOPPED; \
-    YARV_CHECK_INTS(); \
     GVL_UNLOCK_BEGIN(); {\
 	exec; \
     } \
@@ -181,7 +181,6 @@
 thread_cleanup_func(void *th_ptr)
 {
     yarv_thread_t *th = th_ptr;
-    st_delete_wrap(th->vm->living_threads, th->self);
     th->status = THREAD_KILLED;
     th->machine_stack_start = th->machine_stack_end = 0;
 }
@@ -228,6 +227,7 @@
 	    native_thread_interrupt(join_th);
 	    join_th = join_th->join_list_next;
 	}
+	st_delete_wrap(th->vm->living_threads, th->self);
     }
     native_mutex_unlock(&th->vm->global_interpreter_lock);
     return 0;
@@ -745,7 +745,9 @@
     if (th == th->vm->main_thread) {
 	rb_exit(EXIT_SUCCESS);
     }
-    
+
+    thread_debug("rb_thread_kill: %p (%p)\n", th, th->thread_id);
+
     if (th->status == THREAD_STOPPED) {
 	native_thread_interrupt(th);
     }
@@ -1882,17 +1884,19 @@
 mutex_synchronize(VALUE self)
 {
     int state;
+    VALUE val;
+    
     mutex_lock(self);
     PUSH_TAG(PROTO_NONE);
     if ((state = EXEC_TAG()) == 0) {
-	rb_yield(Qnil);
+	val = rb_yield(Qnil);
     }
     mutex_unlock(self);
     POP_TAG();
     if (state) {
 	JUMP_TAG(state);
     }
-    return self;
+    return val;
 }
 
 void

Modified: trunk/thread_pthread.h
===================================================================
--- trunk/thread_pthread.h	2006-02-21 12:09:54 UTC (rev 456)
+++ trunk/thread_pthread.h	2006-02-21 15:05:06 UTC (rev 457)
@@ -136,13 +136,12 @@
 
 struct yarv_signal_thread_list {
     yarv_thread_t *th;
-    int need_signal;
     struct yarv_signal_thread_list *prev;
     struct yarv_signal_thread_list *next;
 };
 
 static struct yarv_signal_thread_list signal_thread_list_anchor = {
-    0, 0, 0, 0,
+    0, 0, 0,
 };
 
 #define FGLOCK(lock, body) do { \
@@ -154,6 +153,19 @@
 } while (0)
 
 static void
+print_signal_list(char *str)
+{
+    struct yarv_signal_thread_list *list =
+      signal_thread_list_anchor.next;
+    thread_debug("list (%s)> ", str);
+    while(list){
+	thread_debug("%p (%p), ", list->th, list->th->thread_id);
+	list = list->next;
+    }
+    thread_debug("\n");
+}
+
+static void
 yarv_add_signal_thread_list(yarv_thread_t *th)
 {
     if (!th->native_thread_data.signal_thread_list) {
@@ -215,6 +227,7 @@
 	tv.tv_usec = 10000;     	/* 10 ms */
 	select(0, NULL, NULL, NULL, &tv);
 #endif
+	
 	if (signal_thread_list_anchor.next) {
 	    FGLOCK(&signal_thread_list_lock, {
 		struct yarv_signal_thread_list *list;


-- 
ML: yarv-diff quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧][生データ]