python库之threading

Thismoduleconstructshigher-levelthreadinginterfacesontopofthelowerlevelpython库之_threadmo

大家好,又见面了,我是全栈君,今天给大家准备了Idea注册码。

  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])

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/120069.html原文链接:https://javaforall.net

赞 (0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • [Python人工智能] 九.gensim词向量Word2Vec安装及《庆余年》中文短文本相似度计算

    [Python人工智能] 九.gensim词向量Word2Vec安装及《庆余年》中文短文本相似度计算从本专栏开始,作者正式开始研究Python深度学习、神经网络及人工智能相关知识。前一篇详细讲解了卷积神经网络CNN原理,并通过TensorFlow编写CNN实现了MNIST分类学习案例。本篇文章将分享gensim词向量Word2Vec安装、基础用法,并实现《庆余年》中文短文本相似度计算及多个案例。本专栏主要结合作者之前的博客、AI经验和相关文章及论文介绍,后面随着深入会讲解更多的Python人工智能案例及应用。基础性文章,希望对您有所帮助~

    2022年6月8日
  • IDEA 2022.01.13激活服务器【最新永久激活】

    (IDEA 2022.01.13激活服务器)好多小伙伴总是说激活码老是失效,太麻烦,关注/收藏全栈君太难教程,2021永久激活的方法等着你。https://javaforall.net/100143.htmlIntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,上面是详细链接哦~1PA3AFINM4-eyJsaWNlbnNlSWQiOi…

    2022年3月31日
  • iptables layer7应用层过滤

    iptables layer7应用层过滤

    2021年8月29日
  • c#正则表达式定义「建议收藏」

    c#正则表达式定义「建议收藏」正则表达式(regularexpression)描述了一种字符串匹配的模式,可以用来检查一个串是否含有某种子串、将匹配的子串做替换或者从某个串中取出符合某个条件的子串等。  列目录时, dir*.txt或ls*.txt中的*.txt就不是一个正则表达式,因为这里*与正则式的*的含义是不同的。  正则表达式是由普通字符(例如字符a到z)以及特殊字符(称为元字符)组成的文

    2022年10月29日
  • UVA10765-Doves and bombs(BCC)

    UVA10765-Doves and bombs(BCC)

    2022年1月31日
  • mysql 查看函数fsync_fsync()函数 Unix/Linux「建议收藏」

    mysql 查看函数fsync_fsync()函数 Unix/Linux「建议收藏」fsync,fdatasync-同步文件在内核态与存储设备内容简介#includeintfsync(intfd);intfdatasync(intfd);描述fsync()transfers(“flushes”)allmodifiedin-coredataof(i.e.,modifiedbuffercachepagesfor)thefilereferre…

    2022年5月18日

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号