mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
20000105
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a1d1b15167
commit
de71615260
69 changed files with 1873 additions and 1103 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue