Skip to content

Commit

Permalink
add extra assertion for deadlock prevention
Browse files Browse the repository at this point in the history
  • Loading branch information
richardsheridan committed Jul 30, 2023
1 parent 9b38070 commit 569af75
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions trio_parallel/_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ async def _aclose(self):
self._lifetime.waiting_task = trio.lowlevel.current_task()
with trio.CancelScope(shield=True):
if self._lifetime.calc_running() != 0:
assert self is not get_default_context()
await trio.sleep_forever() # woken by self._lifetime.__aexit__
await trio.to_thread.run_sync(
self._worker_cache.shutdown, self.grace_period
Expand Down

0 comments on commit 569af75

Please sign in to comment.