如果在python中某些条件匹配时如何在以下代码中停止或退出正在运行的线程:
import threading
class RR_Client(client):
def __init__(self,client_name):
self.del_counter=0
self.client_names()
def client_names(self):
#some code
if (some condition):
self.del_counter=self.del_counter+1
if self.del_counter !=0:
#how to exit thread and return to main before thread is
completed ?
#some more code
def main():
# some code
t=threading.Thread(target=RR_Client, args=(client))
t.start()
if __name__ == '__main__':
main()