摘要:
1 import threading,time 2 3 def run(n): 4 semaphore.acquire() 5 time.sleep(1) 6 print("run in the %s thread"%n) 7 semaphore.release() 8 9 if __name__ == '__main__': 10 ... 阅读全文
posted @ 2017-12-09 23:12
cerofang
阅读(122)
评论(0)
推荐(0)
摘要:
import time,threadingevent = threading.Event()def lighter(): count = 0 event.set()#先设置绿灯 while True: if 5 < count and count < 10: event.clear()#把标志位清了 阅读全文
posted @ 2017-12-09 23:06
cerofang
阅读(496)
评论(0)
推荐(0)
浙公网安备 33010602011771号