davegimo

Untitled

Jan 15th, 2021 (edited)
46
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from multiprocessing import Process
  2. import random
  3. import time
  4.  
  5. def some_function(first, last):
  6. time.sleep(random.randint(1, 3))
  7. print(first,last)
  8.  
  9. processes = []
  10.  
  11. for m in range(1,16):
  12. n = m + 1
  13. p = Process(target=some_function, args=(m, n))
  14. p.start()
  15. processes.append(p)
  16.  
  17. print("not joined")
  18.  
  19. for p in processes:
  20. p.join()
  21.  
  22. print("adesso si")
RAW Paste Data