Python关闭进程,线程,管道,队列,计时器

时间:2019-01-14 14:07:17

标签: python python-3.x process pyqt5

我有几个与管道和队列通信的进程和线程。我需要关闭所有内容,但会出现错误

  

进程以退出代码-1073740791(0xC0000409)完成

我认为问题出在顺序上。首先,我尝试关闭进程,然后关闭线程,然后关闭队列和管道

def reset(self):
    try:
        self.process.terminate()
        self.processBullet.terminate()
        self.tankCollisionProcess.terminate()
        self.processEWC.terminate()
        self.processECB.terminate()
        self.thread.stop()
        self.thread_enemy_bullet.stop()
        if self.move_to_new_level is False:
            self.thread_enemy_move.stop()
            self.myPipe1.close()
            self.myPipe2.close()
            self.queueTile.close()
            self.myPipe1 = None
            self.myPipe2 = None
            self.queueTile = None

        self.queueTileC.close()
        self.queueEWC.close()
        self.pipeB1.close()
        self.pipeB2.close()
        self.pipeBullet1.close()
        self.pipeBullet2.close()
        self.pipeT1.close()
        self.pipeT2.close()
        self.pipe1.close()
        self.pipe2.close()
    except:
        pass
    finally:
        self.process = None
        self.processBullet = None
        self.tankCollisionProcess = None
        self.processECB = None
        self.processEWC = None
        self.thread = None
        self.thread_enemy_bullet = None

        self.player.hide()
        self.player.destroy()
        self.player = None
        self.level.remove_map()
        self.level = None

        self.timer_pecurkica.disconnect()
        self.timer_pecurkica.stop()
        self.timer_pecurkica_hide.disconnect()
        self.timer_pecurkica_hide.stop()
        self.timer_dexm.disconnect()
        self.timer_dexm.stop()
        self.no_pu.disconnect()
        self.no_pu.stop()
        self.power_up = None
        self.enemies.delete_all_enemies()
        self.enemies = None

0 个答案:

没有答案