我该如何定义Thread#initialize
?我尝试了以下方法:
(1)
class Thread
def initialize
super
@foo = []
end
end
Thread.new{}.join
(2)
class Thread
def initialize &pr
super(&pr)
@foo = []
end
end
Thread.new{}.join
(3)
class Thread
def initialize
end
end
Thread.new{}.join
但他们返回一个错误:
Uninitialized thread - check `Thread#initialize'.