我下面有一个小的转发器,它一直在结尾,怎么能从崩溃中修复如此稳定,而不停止运行。。。。 我会在gui中添加一个心跳,看看它是否还在运行。在Wxpthon中,我的菜单栏变为空白或白色。在
def TimerSetup():
import threading, time
invl = 300
def dothis():
try:
FetchUpdates()
except Exception as e:
pass
class Repeat(threading.Thread):
def run(self):
dothis()
if __name__ == '__main__':
for x in range(7000):
thread = Repeat(name = "Thread-%d" % (x + 1))
thread.start()
time.sleep(invl)
这将运行7000次迭代。因此,如果您的运行时间大约为7000*300秒,那么它“完全按照代码工作”:-)然而,线程数量或您在FetchUpdates中所做的事情可能是个问题。当它停止时有回溯吗?正在达到用户限制?在
似乎需要join()来等待启动线程
相关问题 更多 >
编程相关推荐