摘要:
import threading,timedef run(n): lock.acquire()#获取锁 global number number +=1 lock.release()#释放锁 time.sleep(1)#加在释放前会要50秒lock = threading.Lock()#实例numb 阅读全文
posted @ 2020-09-14 22:23
安好_世界
阅读(292)
评论(0)
推荐(0)
摘要:
#直接调用import threading,timedef run(n): print('running ...',n) time.sleep(2)t1 = threading.Thread(target=run,args=("test1",))#生成一个线程实例t2 = threading.Thr 阅读全文
posted @ 2020-09-14 10:39
安好_世界
阅读(131)
评论(0)
推荐(0)