I have this very simple function right here in which I'm trying to run and test on, however, it doesn't output anything and it doesn't have any errors either.
I've checked the code multiple times but it doesn't have any errors.
I printed jobs and here's what I got:
[<Process(Process-12, stopped[1])>,
<Process(Process-13, stopped[1])>,
<Process(Process-14, stopped[1])>,
<Process(Process-15, stopped[1])>,
<Process(Process-16, stopped[1])>]
Here's the code:
import multiprocessing
def worker(num):
print "worker ", num
return
jobs = []
for i in range(5):
p = multiprocessing.Process(target = worker, args = (i,))
jobs.append(p)
p.start()
Here's the result I'm expecting but it's not outputting anything:
Worker: 0
Worker: 1
Worker: 2
Worker: 3
Worker: 4
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…