内容表

  • 平台支持
    • 所有平台
    • Windows
      • Windows 中的子进程支持
    • 就业培训     下载中心     Wiki     联络
      登录   注册

      Log
      1. 首页
      2. Python 3.12.4
      3. 索引
      4. 模块
      5. 下一
      6. 上一
      7. Python 标准库
      8. 网络和进程间通信
      9. asyncio — 异步 I/O
      10. 平台支持

      平台支持 ¶

      The asyncio 模块被设计为可移植,但某些平台有细微差异和局限性,由于平台的底层体系结构和能力。

      所有平台 ¶

      • loop.add_reader() and loop.add_writer() 无法用于监视文件 I/O。

      Windows ¶

      源代码: Lib/asyncio/proactor_events.py , Lib/asyncio/windows_events.py , Lib/asyncio/windows_utils.py


      3.8 版改变: 在 Windows, ProactorEventLoop 现在是默认事件循环。

      Windows 中的所有事件循环都不支持下列方法:

      • loop.create_unix_connection() and loop.create_unix_server() 不被支持。 socket.AF_UNIX socket family is specific to Unix.

      • loop.add_signal_handler() and loop.remove_signal_handler() 不支持。

      SelectorEventLoop 拥有下列局限性:

      • SelectSelector is used to wait on socket events: it supports sockets and is limited to 512 sockets.

      • loop.add_reader() and loop.add_writer() only accept socket handles (e.g. pipe file descriptors are not supported).

      • 管道不支持,所以 loop.connect_read_pipe() and loop.connect_write_pipe() 方法未实现。

      • 子进程 不被支持,即 loop.subprocess_exec() and loop.subprocess_shell() 方法未实现。

      ProactorEventLoop 拥有下列局限性:

      • The loop.add_reader() and loop.add_writer() methods are not supported.

      The resolution of the monotonic clock on Windows is usually around 15.6 milliseconds. The best resolution is 0.5 milliseconds. The resolution depends on the hardware (availability of HPET ) and on the Windows configuration.

      Windows 中的子进程支持 ¶

      On Windows, the default event loop ProactorEventLoop supports subprocesses, whereas SelectorEventLoop 不会。

      The policy.set_child_watcher() function is also not supported, as ProactorEventLoop has a different mechanism to watch child processes.

      macOS ¶

      完全支持现代 macOS 版本。

      macOS <= 10.8

      On macOS 10.6, 10.7 and 10.8, the default event loop uses selectors.KqueueSelector , which does not support character devices on these versions. The SelectorEventLoop can be manually configured to use SelectSelector or PollSelector to support character devices on these older versions of macOS. Example:

      import asyncio
      import selectors
      selector = selectors.SelectSelector()
      loop = asyncio.SelectorEventLoop(selector)
      asyncio.set_event_loop(loop)
      												

      内容表

      • 平台支持
        • 所有平台
        • Windows
          • Windows 中的子进程支持
        • macOS

      上一话题

      策略

      下一话题

      延伸

      本页

      • 报告 Bug
      • 展示源

      快速搜索

      键入搜索术语或模块、类、函数名称。

      1. 首页
      2. Python 3.12.4
      3. 索引
      4. 模块
      5. 下一
      6. 上一
      7. Python 标准库
      8. 网络和进程间通信
      9. asyncio — 异步 I/O
      10. 平台支持

    版权所有  © 2014-2026 乐数软件    

    工业和信息化部: 粤ICP备14079481号-1