''' Lock版的生产者和消费者模式 ''' import threading import random import time gMoney = 1000 # 原始金额 gLoad = threading.Lock() gTime = 0 # 生产次数 class Producer(threading.Thread): def run(self): global gMoney global gTime while True: gLoad.acquire() if gTime < 20: g