1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-01-05 04:41:21 +00:00
parent a1d1b15167
commit de71615260
69 changed files with 1873 additions and 1103 deletions

View file

@ -32,11 +32,11 @@ def timeout(sec)
x = Thread.current
y = Thread.start {
sleep sec
x.raise TimeoutError, "execution expired" if x.status
x.raise TimeoutError, "execution expired" if x.alive?
}
yield sec
return true
ensure
Thread.kill y if y.status
Thread.kill y if y.alive?
end
end