python3 thread
2021-05-04 07:30
标签:utf-8 com class cti live coding targe from des ...占位 python3 thread 标签:utf-8 com class cti live coding targe from des 原文地址:https://www.cnblogs.com/eiguleo/p/13196063.html# -*- 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()))