python使用互斥锁处理资源分配

2023-12-14 13:39:25网络知识悟空
num:%s"%num)

mutex=threading.Lock()

t1=threading.Thread(target=count_test1)

t2=threading.Thread(target=count_test2)

t1.start()

t2.start()

t1.join()

t2.join()

print("最终的num:%s"%num)

以上就是python使用互斥锁处理资源分配,希望能对大家有所帮助,更多Python学习教程请关注IT培训机构:筋斗云。

发表评论: