[MacRuby] #992: dynamic string in thread, in block causing a segfault
MacRuby
ruby-noreply at macosforge.org
Sun Nov 7 22:07:33 PST 2010
#992: dynamic string in thread, in block causing a segfault
-------------------------------------+--------------------------------------
Reporter: mattaimonetti@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: blocker | Milestone: MacRuby 0.8
Component: MacRuby | Keywords:
-------------------------------------+--------------------------------------
The following code triggers a segfault:
{{{
def slow_operation(n); end
n = 10
ths = []
10.times do |n| ths << Thread.new{slow_operation("thread #{n}")} end;
ths.each{|t| t.join}
}}}
Renaming or removing the n variable fixes the problem.
Offline Laurent said:
You build a dynamic string "thread #{n}" inside a thread. n refers to the
block dvar or, at one point, we leave the times loop before the thread
starts to use the variable
--
Ticket URL: <http://www.macruby.org/trac/ticket/992>
MacRuby <http://macruby.org/>
More information about the macruby-tickets
mailing list