进程中t.start(), t.daemon() t.jion()的使用
1 #!/usr/bin/env python 2 import multiprocessing 3 import time 4 def f1(a1): 5 time.sleep(2) 6 print(a1) 7 if __name__ == '__main__': 8 t = multiprocessing.Process(target=f1,args=(11,)) 9 t.daemon = False 10 t.start() 11 t.join(2) 12 t2 = multiprocessing.Process(target=f1, args=(22,)) 13 t2.daemon = False 14 t2.start() 15 t.join(1) 16 print("end")