[前][次][番号順一覧][スレッド一覧]

ruby-changes:6469

From: nobu <ko1@a...>
Date: Thu, 10 Jul 2008 12:10:38 +0900 (JST)
Subject: [ruby-changes:6469] Ruby:r17985 (trunk): * vm_core.h (rb_thread_t), vm.c (rb_thread_mark), process.c

nobu	2008-07-10 12:10:00 +0900 (Thu, 10 Jul 2008)

  New Revision: 17985

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=17985

  Log:
    * vm_core.h (rb_thread_t), vm.c (rb_thread_mark), process.c
      (rb_last_status_get, rb_last_status_set, rb_last_status_clear):
      moved last_status from rb_vm_t.  [ruby-dev:35414]
    
    * vm.c (th_init2): initialize last_status with nil.

  Modified files:
    trunk/ChangeLog
    trunk/KNOWNBUGS.rb
    trunk/bootstraptest/test_thread.rb
    trunk/process.c
    trunk/vm.c
    trunk/vm_core.h

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 17984)
+++ ChangeLog	(revision 17985)
@@ -1,3 +1,11 @@
+Thu Jul 10 12:09:58 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* vm_core.h (rb_thread_t), vm.c (rb_thread_mark), process.c
+	  (rb_last_status_get, rb_last_status_set, rb_last_status_clear):
+	  moved last_status from rb_vm_t.  [ruby-dev:35414]
+
+	* vm.c (th_init2): initialize last_status with nil.
+
 Thu Jul 10 12:09:21 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* thread.c (rb_thread_wait_for): wait until timed out only when
Index: bootstraptest/test_thread.rb
===================================================================
--- bootstraptest/test_thread.rb	(revision 17984)
+++ bootstraptest/test_thread.rb	(revision 17985)
@@ -355,3 +355,9 @@
   sleep 1; m.lock
   :ok
 }
+
+assert_equal 'ok', %q{
+  t = Thread.new {`echo`}
+  t.join
+  $? ? :ng : :ok
+}
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 17984)
+++ vm_core.h	(revision 17985)
@@ -305,7 +305,6 @@
 
     st_table *living_threads;
     VALUE thgroup_default;
-    VALUE last_status; /* $? */
 
     int running;
     int thread_abort_on_exception;
@@ -408,6 +407,7 @@
     rb_control_frame_t *cfp;
     int safe_level;
     int raised_flag;
+    VALUE last_status; /* $? */
     
     /* passing state */
     int state;
Index: KNOWNBUGS.rb
===================================================================
--- KNOWNBUGS.rb	(revision 17984)
+++ KNOWNBUGS.rb	(revision 17985)
@@ -2,9 +2,3 @@
 # This test file concludes tests which point out known bugs.
 # So all tests will cause failure.
 #
-
-assert_equal 'ok', %q{
-  t = Thread.new { system("false") }
-  t.join
-  $? ? :ng : :ok
-}
Index: process.c
===================================================================
--- process.c	(revision 17984)
+++ process.c	(revision 17985)
@@ -218,23 +218,22 @@
 VALUE
 rb_last_status_get(void)
 {
-    return GET_VM()->last_status;
+    return GET_THREAD()->last_status;
 }
 
 void
 rb_last_status_set(int status, rb_pid_t pid)
 {
-    rb_vm_t *vm = GET_VM();
-    vm->last_status = rb_obj_alloc(rb_cProcessStatus);
-    rb_iv_set(vm->last_status, "status", INT2FIX(status));
-    rb_iv_set(vm->last_status, "pid", PIDT2NUM(pid));
+    rb_thread_t *th = GET_THREAD();
+    th->last_status = rb_obj_alloc(rb_cProcessStatus);
+    rb_iv_set(th->last_status, "status", INT2FIX(status));
+    rb_iv_set(th->last_status, "pid", PIDT2NUM(pid));
 }
 
 static void
 rb_last_status_clear(void)
 {
-    rb_vm_t *vm = GET_VM();
-    vm->last_status = Qnil;
+    GET_THREAD()->last_status = Qnil;
 }
 
 /*
Index: vm.c
===================================================================
--- vm.c	(revision 17984)
+++ vm.c	(revision 17985)
@@ -1391,7 +1391,6 @@
 	}
 	RUBY_MARK_UNLESS_NULL(vm->thgroup_default);
 	RUBY_MARK_UNLESS_NULL(vm->mark_object_ary);
-	RUBY_MARK_UNLESS_NULL(vm->last_status);
 	RUBY_MARK_UNLESS_NULL(vm->load_path);
 	RUBY_MARK_UNLESS_NULL(vm->loaded_features);
 	RUBY_MARK_UNLESS_NULL(vm->top_self);
@@ -1547,6 +1546,7 @@
 	RUBY_MARK_UNLESS_NULL(th->fiber);
 	RUBY_MARK_UNLESS_NULL(th->root_fiber);
 	RUBY_MARK_UNLESS_NULL(th->stat_insn_usage);
+	RUBY_MARK_UNLESS_NULL(th->last_status);
 
 	RUBY_MARK_UNLESS_NULL(th->locking_mutex);
 
@@ -1595,6 +1595,7 @@
 
     th->status = THREAD_RUNNABLE;
     th->errinfo = Qnil;
+    th->last_status = Qnil;
 
 #if USE_VALUE_CACHE
     th->value_cache_ptr = &th->value_cache[0];

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]