Lib/test/test_importlib/partial/pool_in_threads.py
raw| 1 | import multiprocessing |
| 2 | import os |
| 3 | import threading |
| 4 | import traceback |
| 5 | |
| 6 | |
| 7 | def t(): |
| 8 | try: |
| 9 | with multiprocessing.Pool(1): |
| 10 | pass |
| 11 | except Exception: |
| 12 | traceback.print_exc() |
| 13 | os._exit(1) |
| 14 | |
| 15 | |
| 16 | def 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 | |
| 26 | if __name__ == "__main__": |
| 27 | main() |