added thread deletion

This commit is contained in:
saloui 2023-09-07 14:53:11 +02:00
parent 0db1fb7d8c
commit 75aa6afc98

View File

@ -47,6 +47,8 @@ def terminate_thread(thread):
res = ctypes.pythonapi.PyThreadState_SetAsyncExc(thread_id, exc)
if res > 1:
ctypes.pythonapi.PyThreadState_SetAsyncExc(thread_id, None)
del thread
gc.collect()
raise SystemError("Failed to terminate the thread.")
else:
ASCIIColors.yellow("Canceled successfully")