This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author تاشيرات مساند
Recipients paul.moore, rls1004, steve.dower, tim.golden, zach.ware, تاشيرات مساند
Date 2019-10-18.11:46:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1571399214.0.0.504807429611.issue38511@roundup.psfhosted.org>
In-reply-to
Content
#!/usr/bin/env python
import multiprocessing, sys, trace
from functools import partial

num_list = ['p1', 'p2', 'p3', 'p4']

def foo(name):
    print(name+'\n')
    return name
def save(result, shared):
    print('a\n')
    shared.results[result] = 1

def mm():
    manager = multiprocessing.Manager()
    shared = manager.dict()
    shared.results = dict()

    clbk = partial(save, shared=shared)

    pool = multiprocessing.Pool(processes=2)
    serial_pool = multiprocessing.Pool(1)

    for name in num_list:
        serial_pool.apply_async(foo, args=[name], callback=clbk)

    pool.close()
    pool.join()

    print(shared.results)

mm()
History
Date User Action Args
2019-10-18 11:46:54تاشيرات مساندsetrecipients: + تاشيرات مساند, paul.moore, tim.golden, zach.ware, steve.dower, rls1004
2019-10-18 11:46:54تاشيرات مساندsetmessageid: <1571399214.0.0.504807429611.issue38511@roundup.psfhosted.org>
2019-10-18 11:46:53تاشيرات مساندlinkissue38511 messages
2019-10-18 11:46:53تاشيرات مساندcreate