1import multiprocessing 2import os 3import threading 4import traceback 5 6 7def t(): 8 try: 9 with multiprocessing.Pool(1): 10 pass 11 except Exception: 12 traceback.print_exc() 13 os._exit(1) 14 15 16def main(): 17 threads = [] 18 for i in range(20): 19 threads.append(threading.Thread(target=t)) 20 for thread in threads: 21 thread.start() 22 for thread in threads: 23 thread.join() 24 25 26if __name__ == "__main__": 27 main() 28