From 3882b07c3a8694e07b30b56e5c2c26c1695122f2 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 18 Jan 2008 14:49:43 +0000 Subject: * thread.c (thread_create_core): set thread group before creating thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ bootstraptest/test_thread.rb | 7 +++++++ thread.c | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6d3a0f4d72..a3fcee5a71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Jan 18 23:49:41 2008 Nobuyoshi Nakada + + * thread.c (thread_create_core): set thread group before creating + thread. + Fri Jan 18 20:19:51 2008 NAKAMURA Usaku * parse.y (ripper_initialize): too early to set parser->enc. diff --git a/bootstraptest/test_thread.rb b/bootstraptest/test_thread.rb index 9711535d72..7810455c87 100644 --- a/bootstraptest/test_thread.rb +++ b/bootstraptest/test_thread.rb @@ -160,6 +160,13 @@ assert_equal %q{[1, 1]}, %q{ sleep 0.1 [thg.list.size, ThreadGroup::Default.list.size] } +assert_equal %q{true}, %q{ + thg = ThreadGroup.new + + t = Thread.new{sleep 5} + thg.add t + thg.list.include?(t) +} assert_equal %q{[true, nil, true]}, %q{ /a/ =~ 'a' $a = $~ diff --git a/thread.c b/thread.c index e45062c206..ead451ccdd 100644 --- a/thread.c +++ b/thread.c @@ -302,7 +302,6 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s #ifdef __ia64 th->machine_register_stack_start = register_stack_start; #endif - th->thgroup = th->vm->thgroup_default; thread_debug("thread start: %p\n", th); native_mutex_lock(&th->vm->global_interpreter_lock); @@ -383,6 +382,7 @@ thread_create_core(VALUE thval, VALUE args, VALUE (*fn)(ANYARGS)) th->first_func = fn; th->priority = GET_THREAD()->priority; + th->thgroup = th->vm->thgroup_default; native_mutex_initialize(&th->interrupt_lock); /* kick thread */ -- cgit v1.2.3