From de6849e860837770693e6f89576530db5087f928 Mon Sep 17 00:00:00 2001 From: Irony <892768447@qq.com> Date: Tue, 13 Mar 2018 12:37:47 +0800 Subject: [PATCH] fix handle is -1 --- 多线程使用/线程挂起恢复.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/多线程使用/线程挂起恢复.py b/多线程使用/线程挂起恢复.py index 54fc402..b2f6636 100644 --- a/多线程使用/线程挂起恢复.py +++ b/多线程使用/线程挂起恢复.py @@ -69,12 +69,16 @@ class Window(QWidget): self.suspendButton.setEnabled(True) def onSuspendThread(self): + if self._thread.handle == -1: + return print('handle is wrong') ret = SuspendThread(self._thread.handle) print('挂起线程', self._thread.handle, ret) self.suspendButton.setEnabled(False) self.resumeButton.setEnabled(True) def onResumeThread(self): + if self._thread.handle == -1: + return print('handle is wrong') ret = ResumeThread(self._thread.handle) print('恢复线程', self._thread.handle, ret) self.suspendButton.setEnabled(True)