python-3.x - 如何在 Python 中停止守护线程
问题描述
我想杀死或停止这个线程,我不知道如何安全地做到这一点,我知道当程序停止时守护线程会被杀死,但我想杀死或停止线程。
def a():
def b():
os.system()
t1 = threading.Thread(target=b, daemon=True)
return t1
class A:
def test():
t1 = a()
t1.start()
"""I want to stop this thread here."""
解决方案
推荐阅读
- angular - 如何在编译期间使Angular忽略错误
- c++ - 如何限制 C++17 模板参数中的 lambda 签名?
- r - 在 R 中的 searchTwitter 包中使用过滤器
- excel - 从 Excel 调用 VBA 函数,“查找”故障?
- java - 在android studio上读取Json文件的简单方法
- docker - 重启服务后 Docker Container 消失
- php - 从扩展 Doctrine\DBAL\Connection 的类中的第二个数据库连接中获取数据
- android - 如何修复 ArrayAdapter 中的类型不匹配?
- flutter - Flutter 垂直可滚动抽屉
- docker - 如何在 chrome 中调试无头 pdf 打印问题?