diff options
author | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-10 05:13:08 +0000 |
---|---|---|
committer | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-10 05:13:08 +0000 |
commit | 8571bdbd6766147ece7b9045bcdf019510a71210 (patch) | |
tree | b3d344e59286476c65ede71010eeb48e59bbfec8 /eval.c | |
parent | c4ff156d912d8bc0d1ffd9da64665aae6317f2e3 (diff) | |
download | ruby-8571bdbd6766147ece7b9045bcdf019510a71210.tar.gz |
* thread.c (rb_threadptr_execute_interrupts_rec, rb_threadptr_raise): Thread#raise with no argument will now re-raise the current exception if there is one [ruby-core:25367]
* eval.c (get_errinfo, rb_rubylevel_thread_errinfo): Getter for current exception for a given thread
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -902,9 +902,8 @@ VALUE rb_f_trace_var(); VALUE rb_f_untrace_var(); static VALUE * -errinfo_place(void) +errinfo_place(rb_thread_t *th) { - rb_thread_t *th = GET_THREAD(); rb_control_frame_t *cfp = th->cfp; rb_control_frame_t *end_cfp = RUBY_VM_END_CONTROL_FRAME(th); @@ -925,19 +924,24 @@ errinfo_place(void) } static VALUE -get_errinfo(void) +get_thread_errinfo(rb_thread_t *th) { - VALUE *ptr = errinfo_place(); + VALUE *ptr = errinfo_place(th); if (ptr) { return *ptr; } else { - rb_thread_t *th = GET_THREAD(); return th->errinfo; } } static VALUE +get_errinfo(void) +{ + return get_thread_errinfo(GET_THREAD()); +} + +static VALUE errinfo_getter(ID id) { return get_errinfo(); @@ -951,7 +955,7 @@ errinfo_setter(VALUE val, ID id, VALUE *var) rb_raise(rb_eTypeError, "assigning non-exception to $!"); } else { - VALUE *ptr = errinfo_place(); + VALUE *ptr = errinfo_place(GET_THREAD()); if (ptr) { *ptr = val; } @@ -984,6 +988,12 @@ rb_rubylevel_errinfo(void) return get_errinfo(); } +VALUE +rb_rubylevel_thread_errinfo(rb_thread_t *th) +{ + return get_thread_errinfo(th); +} + static VALUE errat_getter(ID id) { |