【发布时间】:2012-10-08 11:25:24
【问题描述】:
大家好,我有点麻烦。 我完成了我的程序,它检查是否存在关于 bitbucket 的新版本。 一切都很好,除了当我关闭我的应用程序并且线程仍在运行时,可以在任务管理器中看到该程序。 EVT_CLOSE的代码如下:
def on_close(self, event):
if self._thread is not None and self._thread.isAlive():
self._thread.interrupt.set()
self.Destroy()
event.Skip()
线程像守护进程一样运行。
怎么了?
编辑: 我明白了,我尝试在线程上执行 join() 方法。 但我不工作。
def on_close(self, event):
if self._thread is not None and self._thread.isAlive():
self._thread.join()
self._thread.interrupt.set()
self.Destroy()
event.Skip()
还有:
def on_close(self, event):
if self._thread is not None and self._thread.isAlive():
self._thread.join(10)
self._thread.interrupt.set()
self.Destroy()
event.Skip()
【问题讨论】:
标签: python multithreading wxpython