Le pool utilise Process car il ne peut pas traiter les fonctions locales en parallèle
#! /usr/local/bin/python
# -*- coding:utf-8
import multiprocessing
from time import sleep
def foo():
def f(j,k):
l = j + k
print "no:%s" % i
sleep(5 - i)
print "unko%s" % l
jobs = []
for i in range(5):
p = multiprocessing.Process(target=f,args=(i,100))
jobs.append(p)
p.start()
foo()
Recommended Posts