What kind of problems (if any) would there be combining asyncio with multiprocessing?

后端 未结 3 1167
灰色年华
灰色年华 2020-12-04 07:04

As almost everyone is aware when they first look at threading in Python, there is the GIL that makes life miserable for people who actually want to do processing in parallel

3条回答
  •  没有蜡笔的小新
    2020-12-04 07:56

    See PEP 3156, in particular the section on Thread interaction:

    http://www.python.org/dev/peps/pep-3156/#thread-interaction

    This documents clearly the new asyncio methods you might use, including run_in_executor(). Note that the Executor is defined in concurrent.futures, I suggest you also have a look there.

提交回复
热议问题