diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-12 20:06:59 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-12 20:06:59 +0000 |
commit | d7a19d03334075e29e14e0e2065d29b73e5d5350 (patch) | |
tree | f8aee31917999e2adab92570fcc437cc4c60b0cb /thread.c | |
parent | 161b2e264fcfc0ecb046b35245139e02847bbdb0 (diff) | |
download | ruby-d7a19d03334075e29e14e0e2065d29b73e5d5350.tar.gz |
* 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.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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; |