Advertisement

Python多线程编程中添加线程

阅读量:

参考:

17.1. threading — Thread-based parallelism

一.研究背景概述

二.常见类和函数

Ⅰ.函数

当前仍处于较为初级的阶段,因此此处所介绍的函数也属于基础类型。以下函数主要用于获取当前线程相关的信息。

threading.active_count()

该函数用于返回当前处于活动状态的线程数量,并且其数值与enumerate()函数所返回列表的长度保持一致。

threading.current_thread()

此函数的作用是返回当前线程对象。若调用者的线程控制流并非通过threading模块创建,则会返回一个功能受限的虚拟线程对象。Return the current Thread object, corresponding to the caller’s thread of control. If the caller’s thread of control was not created through the threading module, a dummy thread object with lim

全部评论 (0)

还没有任何评论哟~