From: Eric Wong Date: 2012-11-26T10:25:52+09:00 Subject: [ruby-core:50142] Re: [ruby-trunk - Feature #6762][Assigned] Control interrupt timing SASADA Koichi wrote: > Okay mame-san. > > Eric, could you advice a good name? Really, naming is hard :< I think Thread.may_raise is fine, however... I prefer not to introduce new methods at all, but instead overload the existing begin/ensure syntax. begin async_raise: false # code in this section will not allow exceptions raised by other threads ... end begin ... ensure async_raise: false # code in this section will not allow exceptions raised by other threads ... end (similar to: http://mid.gmane.org/20120720225131.GA15737@dcvr.yhbt.net) Can matz provide feedback on this syntax? I don't know the Ruby parser very well, but I think it is doable without breaking existing code... > Kosaki-san's points: > [ruby-core:48769] [ruby-trunk - Feature #6762] Control interrupt timing If we use Thread.may_raise; how about adding "Thread.test_raise" ? Thread.test_raise would work similar to pthread_testcancel(). I think Thread.test_raise may even just be implemented as: def Thread.test_raise prev = Thread.may_raise Thread.may_raise = true # will raise here on pending exceptions Thread.may_raise = prev end