首页 > 编程语言 > 详细

线程中t.setdaemon(), t.jion(), t.start的使用

时间:2017-02-25 21:38:21      阅读:222      评论:0      收藏:0      [点我收藏+]
 1 import threading
 2 import time
 3 def f0():
 4     pass
 5 def f1(a1,a2):
 6     time.sleep(10)
 7     f0()
 8     print("1")
 9 
10 t1 = threading.Thread(target=f1,args=(111,123))
11 # t.setDaemon(True)
12 t1.start()
13 t1.join(2)#等2秒
14 t2 = threading.Thread(target=f1,args=(111,123))
15 # t.setDaemon(True)
16 t2.start()
17 t2.join()#等待线程结束
18 t3 = threading.Thread(target=f1,args=(111,123))
19 # t.setDaemon(True)
20 t3.start()
21 t3.join()

 

线程中t.setdaemon(), t.jion(), t.start的使用

原文:http://www.cnblogs.com/shiluoliming/p/6442769.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!