摘要: from threading import Thread,Lockimport timea=10b=10lock=Lock()def fun(): # lock.acquire() global a global b a+=1 time.sleep(1) b+=1 # lock.release() 阅读全文
posted @ 2020-03-22 00:36 腹肌猿 阅读(274) 评论(0) 推荐(0) 编辑
摘要: #进程间通信,队列 from multiprocessing import Process,Queue import os,sys import time q=Queue() def get(data): time.sleep(2) print("thread {} get {}".format(o 阅读全文
posted @ 2020-03-22 00:06 腹肌猿 阅读(143) 评论(0) 推荐(0) 编辑