[英]Print a line after Thread.new exit in Ruby
Basically I would like to know when the thread created by Thread.new
exit and puts a line after that. 基本上,我想知道Thread.new
创建的线程Thread.new
退出并在Thread.new
放一行。 How do I do that? 我怎么做?
You can use Thread.join
to block until the thread terminates: 您可以使用Thread.join
阻塞直到线程终止:
thread = Thread.new # Obviously called with necessary arguments
thread.join
puts "Thread has terminated"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.