基本上,我想知道Thread.new
创建的线程何时退出并在其后放置一行。我该怎么做?
您可以使用Thread.join
进行阻塞,直到线程终止:
thread = Thread.new # Obviously called with necessary arguments
thread.join
puts "Thread has terminated"