1

My function:

value1 = []
value2 = []
def func_test(x):
    time.sleep(0.5)
    value1.append(x**3)
    value2.append(x+1)

The goal is to use the processor pools to parallely append values to the lists.

Here's what I did:

pool = mp.Pool(processes=4)
pool.map(func_test, [1,2,3,4,5])

The processes stays stuck. I am assuming it is probably because of deadlock. Is there any way to resolve this?

sjishan
  • 2,812
  • 7
  • 23
  • 49

0 Answers0