python threading & Queue

threading模块

from threading import Thread
for i in range(num_thread):
    t = Thread(target=producer)
    t.daemon = True
    t.start()
def producer():
    while True:
       .........

Queue模块

from Queue import Queue
queue = Queue(queue_capacity)
queue.put(...)
queue.get()

猜你喜欢

转载自blog.csdn.net/weixin_38900691/article/details/81365623
今日推荐