一 綜述:
*thread模塊缺點較多,建議直接使用threading模塊。
*Due to the Global Interpreter Lock(GIL), in CPython only one thread can execute Python code at once. If you want your application to make better of use of the computational resources of multi-core machines, you are advised to usemultiprocessing. However, threading is still an appropriate model if you want to runmultiple I/O-bound tasks simultaneously.
二 thread模塊:暫不介紹。
三 threading模塊:
(1)屬性。
(2)注意:
*當子線程不是守護線程時,主線程執行完後會等待子線程結束;否則主線程將退出(子線程好像也終止了),與pthread庫不太一樣。
四 select模塊