Actually, I like your proposal.
But I make weak objection.
The following code doesn't stop forever.
timeout(3){
# long calculation / infinite loop w/o IO operation
}
I guess most of case, the block includes IO operation and no problem.
However, there are several case for it.
This is Dec and Preview 2 was released.
I think it is too slow to introduce it.
Again, I like this proposal.
If no people have object, I can agree with this proposal.
Alternative proposal is making such a safe timeout method with different
name such as `safe_timeout'.
(2012/12/03 22:33), kosaki (Motohiro KOSAKI) wrote:
Issue #7503 has been reported by kosaki (Motohiro KOSAKI).
Bug #7503: make timeout.rb async-interrupt safe by default
https://bugs.ruby-lang.org/issues/7503
Author: kosaki (Motohiro KOSAKI)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version: 2.0.0
ruby -v: trunk
Hi
Again and again we discussed, current timeout.rb is very dangerous because ExitException interrupt argument code and unwind call stack immediately.
It may prevent to run ensure block and makes resource leak.
I proposed change default to interrupted only on blocking point.
patch is here.
https://gist.github.com/4195015
I also propse to add 'immediate' optional argument because it may help to make a workaround timeout.rb + zero blocking point corner case.
What do you think?
--
// SASADA Koichi at atdot dot net