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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 108是几位数_印度尼西亚总人口数

    108是几位数_印度尼西亚总人口数求给定区间 [X,Y] 中满足下列条件的整数个数:这个数恰好等于 K 个互不相等的 B 的整数次幂之和。例如,设 X=15,Y=20,K=2,B=2,则有且仅有下列三个数满足题意:17=24+2018=24+2120=24+22输入格式第一行包含两个整数 X 和 Y,接下来两行包含整数 K 和 B。输出格式只包含一个整数,表示满足条件的数的个数。数据范围1≤X≤Y≤231−1,1≤K≤20,2≤B≤10输入样例:15 2022输出样例:3#include<bit

    2022年8月9日
    6
  • UItexfile实时验证输入字符「建议收藏」

    UItexfile实时验证输入字符

    2022年1月26日
    48
  • 查看文件内容linux命令_shell查找文件中内容

    查看文件内容linux命令_shell查找文件中内容查看文件内容总览cat由第一行开始显示文件内容tac从最后一行开始显示,可以看出tac是cat的倒着写!nl显示的时候,顺道输出行号!more一页一页的显示文件内容less

    2022年7月30日
    6
  • startservice生命周期_task scheduler 启动后停止

    startservice生命周期_task scheduler 启动后停止ExecutorService接口继承了Executor接口,定义了一些生命周期的方法Java代码publicinterfaceExecutorServiceextendsExecutor{ voidshutdown(); List<Runnable>shutdownNow(); booleanisShutdown(); bool…

    2025年10月20日
    4
  • rpm包怎么打开(ubuntu rpm格式)

    WPSOffice2019ForLinux发布11.1.0.9505版本了,在2020年4月9日提供了wps-office_11.1.0.9505_amd64.deb/rpm下载,支持X64、MIPS、ARM计算机架构。使用旧版本的用户可升级到新版本。WPSOffice2019ForLinux11.1.0.9505版更新内容1、WPS公共:支持金山会议,云上开会,协作无间。支持自…

    2022年4月11日
    75
  • vue组件化的理解_什么是前端组件化

    vue组件化的理解_什么是前端组件化前言有时候有一组html结构的代码,并且这个上面可能还绑定了事件。然后这段代码可能有多个地方都被使用到了,如果都是拷贝来拷贝去,很多代码都是重复的,包括事件部分的代码都是重复的。那么这时候我们就可以

    2022年7月29日
    10

发表回复

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

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