Issue #1717 has been updated by Yehuda Katz.
You could do:
t = Thread.new(Thread.current) do |parent|
# access to parent
end
It seems that having fibers have their own Thread.local is a good thing; otherwise, people who store local things inside of Thread-local variables could have their details suddenly swapped out in certain circumstances.
You could even do:
class Thread
def self.inherit
parent = Thread.current
new do
parent.keys.each do |key|
next if key =~ /^__/
Thread.current[key] = parent[key]
end
yield
end
end
end
Which would be used like Thread.new, but automatically copy the parent's thread-locals to the new thread.
----------------------------------------
http://redmine.ruby-lang.org/issues/show/1717
----------------------------------------
http://redmine.ruby-lang.org