()
| 21 | _global_shutdown_lock = threading.Lock() |
| 22 | |
| 23 | def _python_exit(): |
| 24 | global _shutdown |
| 25 | with _global_shutdown_lock: |
| 26 | _shutdown = True |
| 27 | items = list(_threads_queues.items()) |
| 28 | for t, q in items: |
| 29 | q.put(None) |
| 30 | for t, q in items: |
| 31 | t.join() |
| 32 | |
| 33 | # Register for `_python_exit()` to be called just before joining all |
| 34 | # non-daemon threads. This is used instead of `atexit.register()` for |