[MacRuby] #176: timeout fails to raise a Timeout::Error
MacRuby
ruby-noreply at macosforge.org
Mon Aug 23 09:25:05 PDT 2010
#176: timeout fails to raise a Timeout::Error
---------------------------------+------------------------------------------
Reporter: acangiano@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: major | Milestone:
Component: MacRuby | Keywords:
---------------------------------+------------------------------------------
Comment(by watson1978@…):
{{{
#!ruby
$ cat t.rb
require 'timeout'
puts "** case 1"
v = Timeout.timeout(1) {
52
}
p v == 52
puts "** case 2"
begin
Timeout.timeout(1) {
loop do
1 + 1
end
}
rescue Timeout::Error
p :ok
else
p :ng
end
puts "** case 3"
begin
Timeout.timeout(1) {
1 + 1 while true
}
rescue Timeout::Error
p :ok
else
p :ng
end
puts "** case 4"
th = Thread.new {sleep 2}
begin
Timeout.timeout(1) {th.join}
rescue Timeout::Error
p :ok
else
p :ng
end
}}}
I was not considering "case 4" X(
{{{
$ macruby t.rb
** case 1
true
** case 2
:ok
** case 3
:ok
** case 4
terminate called after throwing an instance of
'RoxorThreadRaiseException*'
zsh: abort macruby t.rb
}}}
--
Ticket URL: <http://www.macruby.org/trac/ticket/176#comment:7>
MacRuby <http://macruby.org/>
More information about the macruby-tickets
mailing list