线程通信-全局变量-标准库threading
2021-03-07 14:31
阅读:639
标签:pre imp sleep rom color start 线程通信 int join() 线程通信-全局变量-标准库threading 标签:pre imp sleep rom color start 线程通信 int join() 原文地址:https://www.cnblogs.com/longyuu/p/14261712.html
from threading import Thread
from time import sleep
a = 1
def foo():
global a
a = 1000
def bar():
sleep(1)
print("a = ",a)
t1 = Thread(target = foo)
t2 = Thread(target = bar)
t1.start()
t2.start()
t1.join()
t2.join()
下一篇:raft 算法扫盲
文章来自:搜素材网的编程语言模块,转载请注明文章出处。
文章标题:线程通信-全局变量-标准库threading
文章链接:http://soscw.com/index.php/essay/61380.html
文章标题:线程通信-全局变量-标准库threading
文章链接:http://soscw.com/index.php/essay/61380.html
评论
亲,登录后才可以留言!