Basically I would like to know when the thread created by Thread.new
exit and puts a line after that. How do I do that?
You can use Thread.join
to block until the thread terminates:
thread = Thread.new # Obviously called with necessary arguments
thread.join
puts "Thread has terminated"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.