python 进程间利用queue 传递参数
2022/4/1 7:21:24
本文主要是介绍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()
这篇关于python 进程间利用queue 传递参数的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-16`PyMuPDF4LLM`:提取PDF数据的神器
- 2024-11-16四种数据科学Web界面框架快速对比:Rio、Reflex、Streamlit和Plotly Dash
- 2024-11-14获取参数学习:Python编程入门教程
- 2024-11-14Python编程基础入门
- 2024-11-14Python编程入门指南
- 2024-11-13Python基础教程
- 2024-11-12Python编程基础指南
- 2024-11-12Python基础编程教程
- 2024-11-08Python编程基础与实践示例
- 2024-11-07Python编程基础指南