线程与线程 [英] Thread vs. Threading

查看:69
本文介绍了线程与线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Python中的threadingthread模块之间有什么区别?

What's the difference between the threading and thread modules in Python?

推荐答案

在Python 3中,thread已重命名为_thread.这是用于实现threading的基础结构代码,而普通的Python代码不应靠近它.

In Python 3, thread has been renamed to _thread. It is infrastructure code that is used to implement threading, and normal Python code shouldn't be going anywhere near it.

_thread公开了底层操作系统级别进程的原始视图.这几乎从来都不是您想要的,因此在Py3k中重命名以表明它实际上只是一个实现细节.

_thread exposes a fairly raw view of the underlying OS level processes. This is almost never what you want, hence the rename in Py3k to indicate that it is really just an implementation detail.

threading添加了一些附加的自动记帐功能,以及一些便捷实用程序,所有这些实用程序使其成为标准Python代码的首选选项.

threading adds some additional automatic accounting, as well as several convenience utilities, all of which makes it the preferred option for standard Python code.

这篇关于线程与线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆