summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-27 02:00:09 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-27 02:00:09 +0000
commit8079f8a6f25bd1e6ef9fa0bff569a850c31c6fb3 (patch)
tree932a03ce36029b926ca796ec72c11dac71ab20f1 /thread.c
parent82cc52ed9373fee7c846e9cf73a67e7a3c94be88 (diff)
* thread.c (thread_join): raises ThreadError if target thread
is a current thread. * test/ruby/test_thread.rb (test_thread_join_current): test for the above. * NEWS: news for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/thread.c b/thread.c
index e74cf6d14a..cdba4a2106 100644
--- a/thread.c
+++ b/thread.c
@@ -736,6 +736,10 @@ thread_join(rb_thread_t *target_th, double delay)
rb_thread_t *th = GET_THREAD();
struct join_arg arg;
+ if (th == target_th) {
+ rb_raise(rb_eThreadError, "Target thread must not be current thread");
+ }
+
arg.target = target_th;
arg.waiting = th;
arg.limit = timeofday() + delay;