标签:custom import range port thread bsp threading class 消费者
1 import queue 2 import threading 3 4 q = queue.Queue(10) 5 def product(i): 6 print(‘put:‘+ str(i)) 7 q.put(i) 8 9 def customer(i): 10 msg = q.get() 11 print(msg) 12 13 for i in range(12): 14 t = threading.Thread(target=product,args=(i,)) 15 t.start() 16 17 for i in range(10): 18 t = threading.Thread(target=customer,args=(i,)) 19 t.start()
标签:custom import range port thread bsp threading class 消费者
原文地址:http://www.cnblogs.com/Erick-L/p/6492833.html