1:Ruby多线程:main线程运行完后,会杀死其他线程,因此需要join进主线程,让主线程等待其他线程运行完后在结束
- x = Thread.new do
- puts "start"
- sleep 2
- puts "thread.."
- sleep 2
- puts "end"
- end
- #主线程执行完后会杀死其他的线程
- p "hello___"
- x.join
转载于:https://blog.51cto.com/athinkingreed/643303
1:Ruby多线程:main线程运行完后,会杀死其他线程,因此需要join进主线程,让主线程等待其他线程运行完后在结束
转载于:https://blog.51cto.com/athinkingreed/643303