Python多線程-join()
http://www.cnblogs.com/holbrook/archive/2012/03/21/2410120.html
上面這篇文章用實例介紹了一下join的使用,該文章解釋join():“線程的合併“,我感覺這樣說不太好理解,不如說成“等待該線程結束“。
聲明:本文介紹介紹的是thread.threading的 join方法
join(timeout=None):
Wait until the thread terminates. This blocks the calling thread until the thread whose join() method is called terminates – either normally or through an unhandled exception – or until the optional timeout occurs.
阻塞調用線程至該線程結束(或異常中斷),最多等待timeout秒的時間。
根據官方解釋,join是由子線程調用,使父線程阻塞的一種方法。簡單一句話來說就是
主線程等待調用join方法的子線程執行結束後再繼續執行
可以參考鏈接中的實例體會一下。