一 综述:
*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模块