diff options
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -711,6 +711,8 @@ thread_create_core(VALUE thval, VALUE args, VALUE (*fn)(ANYARGS)) return thval; } +#define threadptr_initialized(th) ((th)->first_args != 0) + /* * call-seq: * Thread.new { ... } -> thread @@ -742,7 +744,7 @@ thread_s_new(int argc, VALUE *argv, VALUE klass) rb_obj_call_init(thread, argc, argv); GetThreadPtr(thread, th); - if (!th->first_args) { + if (!threadptr_initialized(th)) { rb_raise(rb_eThreadError, "uninitialized thread - check `%"PRIsVALUE"#initialize'", klass); } @@ -2794,7 +2796,9 @@ rb_thread_setname(VALUE thread, VALUE name) } th->name = name; #if defined(SET_ANOTHER_THREAD_NAME) - SET_ANOTHER_THREAD_NAME(th->thread_id, s); + if (threadptr_initialized(th)) { + SET_ANOTHER_THREAD_NAME(th->thread_id, s); + } #endif return name; } |