摘要: queue队列: 使用import, 用法与进程Queue一样 queue is especially useful in threaded programming when information must be exchanged safely between multiple threads. 阅读全文
posted @ 2018-12-03 20:52 AF1y 阅读(118) 评论(0) 推荐(0) 编辑
摘要: python为我们提供的标准模块concurrent.futures里面有ThreadPoolExecutor(线程池)和ProcessPoolExecutor(进程池)两个模块. 在这个模块里他们俩在用法上是一样的. concurrent.futures官方文档: https://docs.pyt 阅读全文
posted @ 2018-12-03 20:04 AF1y 阅读(386) 评论(0) 推荐(0) 编辑
摘要: 1.GIL锁(Global Interpreter Lock) Python代码的执行由Python虚拟机(也叫解释器主循环)来控制。Python在设计之初就考虑到要在主循环中,同时只有一个线程在执行。虽然 Python 解释器中可以“运行”多个线程,但在任意时刻只有一个线程在解释器中运行。 对Py 阅读全文
posted @ 2018-12-03 19:11 AF1y 阅读(326) 评论(0) 推荐(0) 编辑