摘要: 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 fo... 阅读全文
posted @ 2017-03-02 21:59 Erick-LONG 阅读(177) 评论(0) 推荐(0) 编辑
摘要: import threadingimport timenum = 0lock = threading.RLock()def fun(): lock.acquire() global num num+=1 time.sleep(1) print(num) lock.release()for i in 阅读全文
posted @ 2017-03-02 21:15 Erick-LONG 阅读(148) 评论(0) 推荐(0) 编辑