I am trying kill a thread by setting up traces in the python code.
The thread code is given below:
######################################
class KThread(threading.Thread):
"""A subclass of threading.Thread, with a kill() method."""
def __init__(self, *args, **keywords):
threading.Thread.__init__(self, *args, **keywords)
self.killed = False
def start(self):
"""Start the thread."""
self.__run_backup = self.run
self.run = self.__run # Force the Thread to install our trace.
threading.Thread.start(self)
def __run(self):
"""Hacked run function, which installs the trace."""
sys.settrace(self.globaltrace)
self.__run_backup()
self.run = self.__run_backup
But whenever kill() is executed, it gives me the following error
18:31:44.661 - SYSTEM ERROR - Test1: Unhandled exception from test
18:31:44.661 - SYSTEM ERROR - Test1: Traceback (most recent call last):
File "C:\Python24\lib\site-packages\gtest\util\__init__.py", line 220, in run
test.start(testCase)
File "C:\Python24\lib\site-packages\gtest\util\__init__.py", line 466, in start
else:
File ".\Repeater_Main_Test_Protocol2.py", line 114, in run
gtest.util.sleep(10)
File ".\Repeater_Main_Test_Protocol2.py", line 114, in run
gtest.util.sleep(10)
File "u:\development\gtest\ui\TestRunner.py", line 682, in localtrace
raise SystemExit()
SystemExit