摘要:
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... 阅读全文
摘要:
import threadingimport timenum = 0lock = threading.RLock()def fun(): lock.acquire() global num num+=1 time.sleep(1) print(num) lock.release()for i in 阅读全文