0
点赞
收藏
分享

微信扫一扫

python web03-线程-11-使用互斥锁解决资源竞争的问题2

全栈顾问 2022-01-20 阅读 78

python web03-线程-11-使用互斥锁解决资源竞争的问题2

import threading
import time

# 定义一个全局变量
g_num = 0


def test1(num):
    global g_num

    for i in range(num):
        mutex.acquire()  
举报

相关推荐

0 条评论