如何停止守护线程或终止进程?

问题描述

我有这段代码,我想在后台运行。

context.t = threading.Thread(target=psubscribe,args=[context,paramA,paramB,paramC],daemon=True)
context.t.start()

这是正常的 psubscribe to redis 结果是某种通知

def psubscribe(context,paramC):
    context.test_config = load_config()
    RedisConnector(context.test_config["redis_h"],context.test_config["redis_db_"])
    redis_subscriber_connector = RedisConnector(context.test_config["subscriber_redis_h"],int(paramC),int(context.test_config[
                                                                 "subscriber_redis_p"]))
context.redis_connectors = redis_notification_subscribe.psubscribe_to_redis_event(paramA,timeout_seconds=int(
                                                                                             paramB))

但是这个 psubscribe 每一步抛出结果一次,所以实际上有 2 个结果,我只需要一个。 如何停止守护进程发送 psubscribe ?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)