【问题标题】:Default executor asyncio默认执行器 asyncio
【发布时间】:2020-02-13 09:09:00
【问题描述】:

根据文档,将None 传递给run_in_executor 时使用默认执行器:

awaitable loop.run_in_executor(executor, func, *args) 为func安排 在指定的执行器中调用。

executor 参数应该是 concurrent.futures.Executor 实例。如果 executor 为 None,则使用默认 executor。

我的问题是,asyncio 的默认执行器是什么?

【问题讨论】:

    标签: python-3.x python-asyncio


    【解决方案1】:

    我的问题是,asyncio 的默认执行器是什么?

    这是一个concurrent.futures.ThreadPoolExecutordefault settings。以前也可以调用set_default_executor 来使用不同类型的执行器,但在Python 3.8 中,guaranteedThreadPoolExecutor

    【讨论】:

      【解决方案2】:

      你也可以看看cpython source(假设你正在使用)

      【讨论】:

        猜你喜欢
        • 2015-03-22
        • 1970-01-01
        • 2011-10-01
        • 2018-03-03
        • 1970-01-01
        • 1970-01-01
        • 2020-12-06
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多