-
Python標準庫
_thread and threading are both Python standard module, _thread module provides low-level primitives for working with multiple threads(also called light-weight processes or tasks).
Multiple threads of control
sharing their global data space
.For synchronization, simple locks (also calledmutexes
orbinary semaphores
) are provided. Thethreading
module provides an easier to use and higher-level threading API built on top of_thread
. -
threading 常用命令
- threading.active_count() 當前活躍的線程數目
- threading.current_thread() 當前活躍的線程
- threading.Thread() 新建線程對象,獨立於控制線程之外。需要用run()方法啓動。
Python多線程模塊threading、_thread
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.