Joinable list of all non-daemon threads.
| 640 | |
| 641 | |
| 642 | class _Threads(list): |
| 643 | """ |
| 644 | Joinable list of all non-daemon threads. |
| 645 | """ |
| 646 | def append(self, thread): |
| 647 | self.reap() |
| 648 | if thread.daemon: |
| 649 | return |
| 650 | super().append(thread) |
| 651 | |
| 652 | def pop_all(self): |
| 653 | self[:], result = [], self[:] |
| 654 | return result |
| 655 | |
| 656 | def join(self): |
| 657 | for thread in self.pop_all(): |
| 658 | thread.join() |
| 659 | |
| 660 | def reap(self): |
| 661 | self[:] = (thread for thread in self if thread.is_alive()) |
| 662 | |
| 663 | |
| 664 | class _NoThreads: |
no outgoing calls
no test coverage detected
searching dependent graphs…