Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import multiprocessing
- result=[]
- def add(numbers):
- global result
- for n in numbers:
- print('Add'+ str(n+n))
- result.append(n+n)
- print('Add result inside process' + str(result))
- if __name__== '__main__':
- arr=[2,3,8]
- t=time.time()
- p1=multiprocessing.Process(target=add, args=(arr,))
- p1.start()
- p1.join()
- print('Add result outside'+str(result))
- print('done in', time.time()-t)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement