From b1a18cf49bc475e6c563f55b23fa36594d70f4bc Mon Sep 17 00:00:00 2001 From: kosaki Date: Tue, 27 Nov 2012 02:00:19 +0000 Subject: * thread.c (thread_join): raises ThreadError if target therad is a main thread. * test/ruby/test_thread.rb (test_thread_join_main_thread): test for the above. * NEWS: news for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'thread.c') diff --git a/thread.c b/thread.c index cdba4a2106..5214c68955 100644 --- a/thread.c +++ b/thread.c @@ -739,6 +739,9 @@ thread_join(rb_thread_t *target_th, double delay) if (th == target_th) { rb_raise(rb_eThreadError, "Target thread must not be current thread"); } + if (GET_VM()->main_thread == target_th) { + rb_raise(rb_eThreadError, "Target thread must not be main thread"); + } arg.target = target_th; arg.waiting = th; -- cgit v1.2.3