我正在使用python线程来处理数据进程。现在我需要停止已经被satrtted的线程,而在RollingTaskHandler的run()方法中没有停止信号。所以我想知道是否有一种直接停止线程的方法?我使用Thread方法并找到一些方法,有没有人使用这些方法?
> >>> from threading import Thread
> >>> dir(Thread) ['_Thread__bootstrap', '_Thread__bootstrap_inner', '_Thread__delete', '_Thread__exc_clear', '_Thread__exc_info',
> '_Thread__initialized', '_Thread__stop', '__class__', '__delattr__',
> '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__',
> '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__',
> '__repr__', '__setattr__', '__sizeof__', '__str__',
> '__subclasshook__', '__weakref__', '_block', '_note',
> '_reset_internal_locks', '_set_daemon', '_set_ident', 'daemon',
> 'getName', 'ident', 'isAlive', 'isDaemon', 'is_alive', 'join', 'name',
> 'run', 'setDaemon', 'setName', 'start']
from baymax.views.upgrade import RollingTaskHandler
threads=[]
arg ={...}
rolling_task_thread = RollingTaskHandler(arg)
threads.append(rolling_task_thread)
from threading import Thread
class RollingTaskHandler(Thread):