Oops. Sorry, wrong ticket. Please ignore this. 2011/1/19 Yusuke ENDOH <mame / tsg.ne.jp>: > Hi, > > 2011/1/19 Charles Nutter <redmine / ruby-lang.org>: >> I tried to patch this many times, and it's very difficult. The problem here is that kill is inherently broken in the presence of an ensure block. I've discussed this on ruby-core emails in the past and on my blog here: http://blog.headius.com/2008/02/rubys-threadraise-threadkill-timeoutrb.html > > > This is not just a problem of Thread#raise. ¨Βσωξγθςοξουσιηξαμ> (such as Interrupt caused by Ctrl+C) have the same problem. > Of course, we cannot remove Ctrl+C. > > Thus, to address this problem faithfully, we should provide a > mechanism to safely handle asynchronous exceptions. ¨Βοββωιξτο > eliminate only Thread#raise (and #kill) is not facing the reality. > > Fortunately, there are some ancient wisdoms: > > "cancellation points" of pthread > ¨ΒττπΊ――χχχ®λεςξεμ®οςη―δογ―ναξπαηεσ―οξμιξε―παηεσ―ναξ·―πτθςεαδσ®·®θτνμ > > Asynchronous Exceptions in Haskell > ¨ΒττπΊ――γιτεσεεςψ®ιστ®πσυ®εδυ―φιεχδογ―συνναςωΏδοι½±°®±®±®²¶®±°΄° > > These two are based on a very similar idea: providing a feature > to control whether asynchronous exceptions may be raised or may > not. ¨Βζαγττθματτες ισ ςεζεςςεδ ιξ γοννεξτσ οζ ωους βμοη > article. ¨Βυτ ιτ χαςεκεγτεδ ασ> >> there are a lot of additional problems when implementing it in an environment that isn't as functionally pure as Haskell > > I guess that this is misinterpretation. ¨Βισ φεςω σινιματο τθ> former (cancellation points), and can be implemented even in > imperative programming language, as pthread does. ¨Β δοξ§λξοχ > that they are compatible with Java (and/or JRuby) threads, though. > > > On a separate note, I'm not against deprecating Thread#raise. > It is indeed too difficult to use correctly. ¨Βυσεμινιξατιξιτ> however, is not enough. > > >> the child thread may still wake up between the end of the user-defined block and the call to kill > > > Yes, it may occur. ¨Βυτ δοεσ ιτ γαυσαξαγτυαμ πςοβμειξ τθ> case of timeout.rb? ¨Βοσαλι§πατγσεεντο νε ηοοδ> > -- > Yusuke Endoh <mame / tsg.ne.jp> > > -- Yusuke Endoh <mame / tsg.ne.jp>