mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
52f90f6566
commit
cef64ee0ba
4 changed files with 104 additions and 68 deletions
|
@ -39,6 +39,12 @@ def timeout(sec)
|
|||
yield sec
|
||||
return true
|
||||
ensure
|
||||
Thread.kill y if y.alive?
|
||||
Thread.kill y if y and y.alive?
|
||||
end
|
||||
end
|
||||
|
||||
if __FILE__ == $0
|
||||
timeout(5) {
|
||||
p 10
|
||||
}
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue