تاشيرات مساند <musaned0...@gmail.com> added the comment:

#!/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()

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38511>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to