[MacRuby-devel] [MacRuby] #620: Yielding a block inside a loop in a thread crashes the VM
MacRuby
ruby-noreply at macosforge.org
Fri Feb 19 01:59:35 PST 2010
#620: Yielding a block inside a loop in a thread crashes the VM
---------------------------------+------------------------------------------
Reporter: honglilai@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: blocker | Milestone:
Component: MacRuby | Keywords:
---------------------------------+------------------------------------------
Yielding a block inside a loop directly in the Thread block results in a
VM crash:
{{{
Assertion failed: ((b->flags & flags) == flags), function
rb_vm_prepare_block, file dispatcher.cpp, line 1737.
Abort trap
}}}
Interestingly, the problem doesn't occur of the loop is wrapped inside a
function.
Reproduce with:
{{{
require 'thread'
def do_yield
yield
end
# This doesn't crash.
Thread.new do
do_yield do
end
do_yield do
end
do_yield do
end
end.join
# This doesn't crash either.
def do_yield_loop_in_function
while true
do_yield do
end
end
end
Thread.new do
do_yield_loop_in_function
end.join
# This crashes.
Thread.new do
3.times do
do_yield do
end
end
end.join
# This crashes too.
Thread.new do
while true
do_yield do
end
end
end.join
}}}
--
Ticket URL: <http://www.macruby.org/trac/ticket/620>
MacRuby <http://macruby.org/>
More information about the MacRuby-devel
mailing list