省去了线程函数和获取结果的麻烦

threadit的Python项目详细描述


Python Threadit

毫不费力地在线程中运行函数

PyPI - FormatPyPI - StatusDownloadsPyPI - Python Version

一个很好的包,可以帮助您在线程中运行函数并获得结果。
正在开发中!因此,请在更新之前检查是否有更改

安装

pip install threadit

用法

^{pr2}$

主命令

# Import the modulefromthreaditimportThreadIT# Start your function with or without argumentsvar=ThreadIT(function,args,kwargs)# Wait for the function to finnish or get the result if its finishedvar.result()

可选命令

# Check if your thread is still working on the function.# This will return True if the function is not completed.var.doing_work()# Terminate the thread. This will noe wait for the function to # finnish and will return None as result if the function is not# done within the timelimit setvar.result(timeout=10)

测试

使用以下命令运行测试。在

python -m unittest threadit.tests.test_threadit

变更日志:

看到了吗变更日志.md在

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何将cassandra中的行数据转换为与列相关的嵌套json   java如何使用jcr XPath在jcr:content/@jcr:data中搜索?   java在使用openCV进行安卓开发时如何利用手机的广角镜头   java解析扩展了接口,结束了一个潜在的无限循环   位置服务的@Override方法中存在java Android应用程序错误   java本地线程的用途和需求是什么   具有左右子访问的java节点树遍历   java验证JsonWebToken签名   JUL日志处理程序中的java日志记录   嵌入式Java读取给定时间段的串行数据。   java有没有办法从多个URL获取多个图像?   java线程通过等待intent阻止自己发送intent   java Spring MVC解析多部分内容请求   java JPA/Hibernate静态元模型属性未填充NullPointerException   java格式错误的字符(需要引号,得到I)~正在处理   java为什么PrintWriter对象抛出FileNotFoundException?   java Neo4j未正确保存标签   java IE不加载图像