mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-09 18:39:04 +08:00
Fix: Missing type check on log queue handler thread
This commit is contained in:
parent
701d4bf955
commit
4d46ab45e8
@ -41,7 +41,7 @@ class ProcessManager:
|
||||
self._process.terminate()
|
||||
self.log.append(
|
||||
f"[{self.config_name}] exited. Reason: Manual stop\n")
|
||||
if self.thd_log_queue_handler.is_alive():
|
||||
if self.thd_log_queue_handler is not None:
|
||||
self.thd_log_queue_handler.stop()
|
||||
logger.info(f"[{self.config_name}] exited")
|
||||
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import ctypes
|
||||
import datetime
|
||||
import operator
|
||||
from queue import Queue
|
||||
import re
|
||||
import threading
|
||||
import time
|
||||
from queue import Queue
|
||||
from typing import Callable, Generator, List
|
||||
|
||||
from module.logger import logger
|
||||
@ -36,12 +36,13 @@ class Thread(threading.Thread):
|
||||
return thd_id
|
||||
|
||||
def stop(self):
|
||||
thread_id = self._get_id()
|
||||
res = ctypes.pythonapi.PyThreadState_SetAsyncExc(thread_id,
|
||||
ctypes.py_object(SystemExit))
|
||||
if res > 1:
|
||||
ctypes.pythonapi.PyThreadState_SetAsyncExc(thread_id, 0)
|
||||
print('Exception raise failure')
|
||||
if self.is_alive():
|
||||
thread_id = self._get_id()
|
||||
res = ctypes.pythonapi.PyThreadState_SetAsyncExc(thread_id,
|
||||
ctypes.py_object(SystemExit))
|
||||
if res > 1:
|
||||
ctypes.pythonapi.PyThreadState_SetAsyncExc(thread_id, 0)
|
||||
logger.error('Exception raise failure')
|
||||
|
||||
|
||||
class Task:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user