0

i have created a sample code to run multiple functions at same time ad its works but i am unable to get the return values. So how to check the return values.

from multiprocessing import Process

a= 10;
b=20;
def calculate_sum(x,y):
    print('start sum')
    c = x+y
    #print(c)
    #print('end sum')
    #print(c)
    return c

def calculate_subst(x,y):
    print('start subt')
    v = y-x
    
    #print('end sum')
    return v

if __name__ == '__main__':
    p1 = Process(target=calculate_sum,args=(a,b))
    p1.start()
    
    p2 = Process(target=calculate_subst,args=(a,b))
    p2.start()
    p1.join()
    p2.join()
  • NB: there are many different ways to do this, but [this answer](https://stackoverflow.com/a/59486541/984421) summarises of some of the simpler solutions. – ekhumoro Aug 13 '20 at 16:08
  • @ekhumoro thanks for it, but i want output of both the function at the same time. so please help on this. – Dheeraj kumar Aug 14 '20 at 05:25
  • Then use a queue, or any of the other solutions shown in the linked question. – ekhumoro Aug 14 '20 at 10:01

0 Answers0