python 进程间利用queue 传递参数
作者:互联网
from multiprocessing import Process def chulibkk(bka,q): global connect,con for acc in acca: result=[] aty=str(acc["rootId"]) userid=str(acc['userId']) q.put(userid) def wm0323(q): global con,connect while 1: sql2="select bk from bkdxy where zg<>'2' ORDER BY RAND() LIMIT 5 " aa=get_one(sql2) sql3="update bkdxy set zg='1' where bk={}".format(aa[0]) zxupdate(sql3) #aa=("64",) chulibkk(aa[0],q) sql3="update bkdxy set zg='2' where bk={}".format(aa[0]) zxupdate(sql3) def wm0324(q): global con,connect while 1: if not q.empty(): va=q.get(True) print(va) if jiancea(va)==0: chulixx(va) if __name__=='__main__': global connect,con q = Queue() pw = Process(target=wm0323, args=(q,)) pr = Process(target=wm0324, args=(q,)) ## pw1 = Process(target=wm0323, args=(q,)) ## pw1.start() pw.start() pr.start() ## pw1.join() pw.join() pr.join()
标签:aa,__,sql3,va,python,global,queue,参数,con 来源: https://www.cnblogs.com/xkdn/p/16081162.html