pdf_code/zzb_data/test_process.py

18 lines
476 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from multiprocessing import Process
import time
import threading
import config_init
def process_start(sec):
processes = []
for i in range(2):
p = Process(target=config_init.run_job, args=(sec,))
processes.append(p)
p.start()
for p in processes:
p.join()
print('所有子任务完成任务ID:', sec)
threading.Thread(target=process_start, args=(6,)).start()
threading.Thread(target=process_start, args=(2,)).start()