selectors
— 高级 I/O 复用
¶
Added in version 3.4.
源代码: Lib/selectors.py
介绍 ¶
此模块允许高级且高效的 I/O 复用,构建于
select
模块原语。鼓励用户使用此模块取而代之,除非想要精确控制所用的 OS 级别原语。
它定义
BaseSelector
抽象基类,除了几个具体实现 (
KqueueSelector
,
EpollSelector
…), that can be used to wait for I/O readiness notification on multiple file objects. In the following, “file object” refers to any object with a
fileno()
method, or a raw file descriptor. See
文件对象
.
DefaultSelector
is an alias to the most efficient implementation available on the current platform: this should be the default choice for most users.
注意
The type of file objects supported depends on the platform: on Windows, sockets are supported, but not pipes, whereas on Unix, both are supported (some other types may be supported as well, such as fifos or special file devices).
另请参阅
-
select -
低级 I/O 复用模块。
可用性 :非 WASI。
This module does not work or is not available on WebAssembly. See WebAssembly 平台 了解更多信息。
类 ¶
类层次结构:
BaseSelector +-- SelectSelector +-- PollSelector +-- EpollSelector +-- DevpollSelector +-- KqueueSelector