12.py 333 B

12345678910111213141516171819
  1. from multiprocessing import Queue,Process,freeze_support
  2. import time
  3. def f():
  4. while(True):
  5. print(1)
  6. time.sleep(1)
  7. if __name__=="__main__":
  8. freeze_support()
  9. while(True):
  10. p = Process(target=f)
  11. p.start()
  12. p.join()
  13. # time.sleep(4)
  14. # p.terminate()
  15. # p.start()