1
這是一個非常簡單的問題。簡單的紅寶石對象順序
def func1
t2=Thread
while true
# if t2.alive?
# puts "GUI is running"
# end
puts Thread.t2.stop?
puts "func1 at: #{Time.now}"
sleep(1)
end
end
t1=Thread.new{func1()}
t2=Thread.new{TheGUI()}
t1.join
t2.join
t2僅在代碼中稍後聲明,因此在嘗試運行時出現錯誤。 錯誤是'未定義的局部變量或方法't2''
如何解決這個問題,而不需要重新排序我的代碼?
感謝
我更新的代碼。謝謝 –
哇,非常感謝! –