mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7ad9faa528
commit
1a5f1a8c69
6 changed files with 23 additions and 15 deletions
|
@ -1,3 +1,11 @@
|
|||
Thu Jul 10 12:09:58 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* thread.c (rb_thread_wait_for): wait until timed out only when
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -355,3 +355,9 @@ assert_equal 'ok', %q{
|
|||
sleep 1; m.lock
|
||||
:ok
|
||||
}
|
||||
|
||||
assert_equal 'ok', %q{
|
||||
t = Thread.new {`echo`}
|
||||
t.join
|
||||
$? ? :ng : :ok
|
||||
}
|
||||
|
|
13
process.c
13
process.c
|
@ -218,23 +218,22 @@ static VALUE rb_cProcessStatus;
|
|||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
3
vm.c
3
vm.c
|
@ -1391,7 +1391,6 @@ rb_vm_mark(void *ptr)
|
|||
}
|
||||
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 @@ rb_thread_mark(void *ptr)
|
|||
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_init2(rb_thread_t *th, VALUE self)
|
|||
|
||||
th->status = THREAD_RUNNABLE;
|
||||
th->errinfo = Qnil;
|
||||
th->last_status = Qnil;
|
||||
|
||||
#if USE_VALUE_CACHE
|
||||
th->value_cache_ptr = &th->value_cache[0];
|
||||
|
|
|
@ -305,7 +305,6 @@ struct rb_vm_struct
|
|||
|
||||
st_table *living_threads;
|
||||
VALUE thgroup_default;
|
||||
VALUE last_status; /* $? */
|
||||
|
||||
int running;
|
||||
int thread_abort_on_exception;
|
||||
|
@ -408,6 +407,7 @@ struct rb_thread_struct
|
|||
rb_control_frame_t *cfp;
|
||||
int safe_level;
|
||||
int raised_flag;
|
||||
VALUE last_status; /* $? */
|
||||
|
||||
/* passing state */
|
||||
int state;
|
||||
|
|
Loading…
Reference in a new issue