mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-34769: Thread safety for _asyncgen_finalizer_hook(). (GH-9716)
This commit is contained in:
parent
79d21331e6
commit
c880ffe7d2
3 changed files with 71 additions and 4 deletions
|
@ -477,10 +477,7 @@ class BaseEventLoop(events.AbstractEventLoop):
|
|||
def _asyncgen_finalizer_hook(self, agen):
|
||||
self._asyncgens.discard(agen)
|
||||
if not self.is_closed():
|
||||
self.create_task(agen.aclose())
|
||||
# Wake up the loop if the finalizer was called from
|
||||
# a different thread.
|
||||
self._write_to_self()
|
||||
self.call_soon_threadsafe(self.create_task, agen.aclose())
|
||||
|
||||
def _asyncgen_firstiter_hook(self, agen):
|
||||
if self._asyncgens_shutdown_called:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue