doublex <[email protected]> added the comment:
Example code (fails):
import os, concurrent.futures
def parallel_callback( arg ):
return os.getpid()
def parallel( *args ):
def thread_callback( param ):
with concurrent.futures.ProcessPoolExecutor(max_workers=1) as executor:
future = executor.submit( parallel_callback, param )
pid = future.result()
print( 'pid:', pid )
return pid
with concurrent.futures.ThreadPoolExecutor(max_workers=len(args)) as
executor:
future = executor.map( thread_callback, args )
results = list(future)
print( 'DONE' )
parallel( 1, 2, 3 )
----------
nosy: +doublex
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue41567>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com