[Python-Dev] PEP 567 v3 (original) (raw)

Antoine Pitrou solipsis at pitrou.net
Tue Jan 16 19:37:34 EST 2018


On Tue, 16 Jan 2018 17:44:14 -0500 Yury Selivanov <yselivanov.ml at gmail.com> wrote:

Offloading execution to other threads -------------------------------------

It is possible to run code in a separate OS thread using a copy of the current thread context:: executor = ThreadPoolExecutor() currentcontext = contextvars.copycontext() executor.submit( lambda: currentcontext.run(somefunction))

Does it also support offloading to a separate process (using ProcessPoolExecutor in the example above)? This would require the Context to support pickling.

Regards

Antoine.



More information about the Python-Dev mailing list