summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-12 20:06:59 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-12 20:06:59 +0000
commitd7a19d03334075e29e14e0e2065d29b73e5d5350 (patch)
treef8aee31917999e2adab92570fcc437cc4c60b0cb /thread.c
parent161b2e264fcfc0ecb046b35245139e02847bbdb0 (diff)
* thread.c (rb_thread_raise): check if target thread is
thrown by another thread or not. [ruby-dev:31371] * bootstraptest/test_thread.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/thread.c b/thread.c
index 7ff9439cf4..bae2fd7555 100644
--- a/thread.c
+++ b/thread.c
@@ -758,12 +758,17 @@ rb_thread_raise(int argc, VALUE *argv, rb_thread_t *th)
{
VALUE exc;
+ again:
if (rb_thread_dead(th)) {
return Qnil;
}
+ if (th->thrown_errinfo != 0 || th->raised_flag) {
+ rb_thread_schedule();
+ goto again;
+ }
+
exc = rb_make_exception(argc, argv);
- /* TODO: need synchronization if run threads in parallel */
th->thrown_errinfo = exc;
rb_thread_ready(th);
return Qnil;