标签:ESS port targe def tip struct star imp exiting
import multiprocessing as mp import time def name_and_time(name,num): print(f"Hello {name}, current time is {time.time()} ({num})") print(‘Sleeping for 2 seconds ...‘) time.sleep(2) print("After sleeping ... exiting function") if __name__ == ‘__main__‘: process_list = list() for i in range(100): process = mp.Process(target=name_and_time,args=(‘Andrei‘,i)) process_list.append(process) for p in process_list: p.start() for p in process_list: p.join() print(‘Other instructions of the main module....‘) print(‘End of Script‘)
[Python]Running multiprocessing
标签:ESS port targe def tip struct star imp exiting
原文地址:https://www.cnblogs.com/jbite9057/p/12235503.html