()
| 68 | |
| 69 | @contextlib.contextmanager |
| 70 | def _track_active_thread() -> Generator[None, None, None]: |
| 71 | try: |
| 72 | active_threads_local = _active_threads_local.get() |
| 73 | except LookupError: |
| 74 | active_threads_local = _ActiveThreadCount(0, Event()) |
| 75 | _active_threads_local.set(active_threads_local) |
| 76 | |
| 77 | active_threads_local.count += 1 |
| 78 | try: |
| 79 | yield |
| 80 | finally: |
| 81 | active_threads_local.count -= 1 |
| 82 | if active_threads_local.count == 0: |
| 83 | active_threads_local.event.set() |
| 84 | active_threads_local.event = Event() |
| 85 | |
| 86 | |
| 87 | async def wait_all_threads_completed() -> None: |
no test coverage detected
searching dependent graphs…