首页 > 编程语言 > 详细

python3 thread

时间:2020-06-26 20:03:48      阅读:53      评论:0      收藏:0      [点我收藏+]

...占位

# -*- coding:utf-8 -*-
# date:20200616
# auth:hxx@uniontech.com
# description: 后台计算期间,打印一堆无效内容, 查询完成后,停止无效打印, 输出有效内容

 

from mdiso.dbcon import DBClient
from mdiso.shrun import ShRun
from threading import Thread
import time
mydb=DBClient()

def func1():
diff_res=mydb.diff_ini_cur()
#time.sleep(10)
t1=Thread(target=func1)

fo=open(/tmp/mdsum_ini, r)
data=fo.readline()


t1.start()

while t1.isAlive():
if len(data) >3 and t1.isAlive() :
print(data.strip())
data=fo.readline()
else:
fo.seek(0)
data=fo.readline()
time.sleep(0.05)

fo.close()

#print("in while liave", time.ctime(time.time()))


print("main end ", time.ctime(time.time()))

 

python3 thread

原文:https://www.cnblogs.com/eiguleo/p/13196063.html

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