Ronald Oussoren <[email protected]> added the comment:
This issue can probably be closed as out of date:
Using: Python3.9, installer from python.org. On my laptop os.cpu_count() == 8.
"python -c 'import repro; repro.main()' works for me (it runs a while and
exists when all workers have exited). The repro module contains the code below,
this is the code from the original message with some changes because of changes
to the multiprocessing launcher strategy on macOS.
# repro.py
import multiprocessing
from multiprocessing import Pool, Manager
import time
import random
def worker_function( index, messages ):
print( "%d: Entered" % index )
time.sleep( random.randint( 3, 15 ) )
messages.put( "From: %d" % index )
print( "%d: Exited" % index )
def main():
manager = Manager()
messages = manager.Queue()
with Pool( processes = None ) as pool:
for x in range( 30 ):
pool.apply_async( worker_function, [ x, messages ] )
pool.close()
pool.join()
# EOF
----------
nosy: +ronaldoussoren
resolution: -> out of date
stage: -> resolved
status: open -> pending
type: -> behavior
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue32937>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com