This module constructs higher-level threading interfaces on top of the lower level python库之_threadmodule

  官方参考文档:https://docs.python.org/2/library/threading.html

threading库对象和方法

(1)threading.active_count()

(2)theading.Condition()

  A factory function that returns a new condition variable object,See Condition Objects.

(3)threading.current_thread()

(4)threading.enumerate()

  Return a list of all Thread objects currently alive. The list includes daemonic threads, dummy thread objects created by current_thread(), and the main thread. It excludes terminated threads and threads that have not yet been started.

(5)threading.event()

  A factory function that returns a new event object. An event manages a flag that can be set to true with the set() method and reset to false with the clear() method. The wait() method blocks until the flag is true.See Event Objects.

(6)class threading.local 

   A class that represents thread-local data. Thread-local data are data whose values are thread specific. To manage thread-local data, just create an instance of local (or a subclass) and store attributes on it:

  mydata = threading.local()
  mydata.x = 1

  The instance’s values will be different for separate threads.

  For more details and extensive examples, see the documentation string of the _threading_local module.

(7)theading.Lock()

  A factory function that returns a new primitive lock object. Once a thread has acquired it, subsequent attempts to acquire it block, until it is released; any thread may release it.See Lock Objects.

(8)threading.RLock()

  A factory function that returns a new reentrant lock object. A reentrant lock must be released by the thread that acquired it. Once a thread has acquired a reentrant lock, the same thread may acquire it again without blocking; the thread must release it once for each time it has acquired it.See RLock Objects.

(9)threading.Semaphore([value])

  A factory function that returns a new semaphore object. A semaphore manages a counter representing the number of release() calls minus the number of acquire() calls, plus an initial value. The acquire() method blocks if necessary until it can return without making the counter negative. If not given, value defaults to 1.See Semaphore Objects.

(10)threading.BoundedSemaphore([value])

  A factory function that returns a new bounded semaphore object. A bounded semaphore checks to make sure its current value doesn’t exceed its initial value. If it does, ValueError is raised. In most situations semaphores are used to guard resources with limited capacity. If the semaphore is released too many times it’s a sign of a bug. If not given, value defaults to 1.

(11)class threading.Thread

  A class that represents a thread of control. This class can be safely subclassed in a limited fashion.See Thread Objects.

(12)class threading.Timer

  A thread that executes a function after a specified interval has passed.See Timer Objects.

(13)threading.settrace(func)

(14)threading.setprofile(func)

(15)threading.stack_size([size])

python库之threading的更多相关文章

  1. Python 库大全

    作者:Lingfeng Ai链接:http://www.zhihu.com/question/24590883/answer/92420471来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非 ...

  2. 哪些 Python 库让你相见恨晚?【转】

    原文链接:https://www.zhihu.com/question/24590883/answer/92420471 原文链接:Python 资源大全 ---------------- 这又是一个 ...

  3. Python库资源大全

    转载地址:https://zhuanlan.zhihu.com/p/27350980 本文是一个精心设计的Python框架.库.软件和资源列表,是一个Awesome XXX系列的资源整理,由BigQu ...

  4. Python库,让你相见恨晚的第三方库

    环境管理 管理 Python 版本和环境的工具 p – 非常简单的交互式 python 版本管理工具.pyenv – 简单的 Python 版本管理工具.Vex – 可以在虚拟环境中执行命令.virt ...

  5. Python 库,资源

    库名称简介 Chardet字符编码探测器,可以自动检测文本.网页.xml的编码. colorama主要用来给文本添加各种颜色,并且非常简单易用. Prettytable主要用于在终端或浏览器端构建格式 ...

  6. Python资源 --Python库

    环境管理 管理 Python 版本和环境的工具 pyenv – 简单的 Python 版本管理工具. Vex – 可以在虚拟环境中执行命令. virtualenv – 创建独立 Python 环境的工 ...

  7. python 库资源大全

    偶然的机会翻到这篇文章,很全面,来源:  Python 资源大全中文版       哪些 Python 库让你相见恨晚? 环境管理 管理 Python 版本和环境的工具 p:非常简单的交互式 pyth ...

  8. Python库大全

    网络 urllib -网络库(stdlib). requests -网络库. grab – 网络库(基于pycurl). pycurl – 网络库(绑定libcurl). urllib3 – Pyth ...

  9. Python 库汇总中文版

    这又是一个 Awesome XXX 系列的资源整理,由 vinta 发起和维护.内容包括:Web框架.网络爬虫.网络内容提取.模板引擎.数据库.数据可视化.图片处理.文本处理.自然语言处理.机器学习. ...

随机推荐

  1. Spark机器学习8· 文本处理(spark-shell)

    Spark机器学习 自然语言处理(NLP,Natural Language Processing) 提取特征 建模 机器学习 TF-IDF(词频 term frequency–逆向文件频率 inver ...

  2. Authentication token is no longer valid

    Linux: Authentication token is no longer valid Problem: Authentication token is no longer valid; new ...

  3. 做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)?

    import random import string def GenKey(length): chars = string.ascii_letters + string.digits return ...

  4. float 为什么可以表示很大的整数

    1.float型:单精度浮点数在机内占4个字节,用32位二进制描述(注意:计算机中1个字节=8位). 2.浮点数在机内用指数型式表示,分解为:数符,尾数,指数符,指数四部分. 3.可以算出float型 ...

  5. gradle-rn-app工程运行须知

    singwhatiwanna edited this page 16 days ago · 5 revisions  Pages 7 Home Demo 工程运行须知 VirtualAPK API 概 ...

  6. 编译安卓7.0源码出现make: *** [ninja_wrapper] Error 1【转】

    本文转载自:https://blog.csdn.net/u010684585/article/details/76263317 32 warnings generated.ninja: build s ...

  7. CPU、内存通俗概念

    在计算机的组成结构中,有一个很重要的部分,就是存储器.存储器是用来存储程序和数据的部件,对于计算机来说,有了存储器,才有记忆功能,才能保证正常工作.存储器的种类很多,按其用途可分为主存储器和辅助存储器 ...

  8. Prims算法 - 最小生成树

    2017-07-26  14:35:49 Prims算法,是一种基于“贪心”的求最小树的算法 ,以每次加入一个邻接边来建立最小树,直到找到N-1个边为止. 规则:以开始时生成树的集合为起始的顶点,然后 ...

  9. codeforces781A Andryusha and Colored Balloons

    本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000 作者博客:http://www.cnblogs.com/ljh2000-jump/ ...

  10. tech| kafka入门书籍导读

    J梳理了一下自己在入门 kafka 时读过的一些书, 希望能帮助到对 kafka 感兴趣的小伙伴. 涉及到的书籍: kafka 权威指南 Kafka: The Definitive Guide (ka ...