mirror of
https://github.com/python/cpython.git
synced 2025-10-14 10:53:40 +00:00
gh-128340: add thread safe handle for loop.call_soon_threadsafe
(#128369)
Adds `_ThreadSafeHandle` to be used for callbacks scheduled with `loop.call_soon_threadsafe`.
This commit is contained in:
parent
657d7b77e5
commit
7e8c571604
4 changed files with 151 additions and 1 deletions
|
@ -873,7 +873,10 @@ class BaseEventLoop(events.AbstractEventLoop):
|
|||
self._check_closed()
|
||||
if self._debug:
|
||||
self._check_callback(callback, 'call_soon_threadsafe')
|
||||
handle = self._call_soon(callback, args, context)
|
||||
handle = events._ThreadSafeHandle(callback, args, self, context)
|
||||
self._ready.append(handle)
|
||||
if handle._source_traceback:
|
||||
del handle._source_traceback[-1]
|
||||
if handle._source_traceback:
|
||||
del handle._source_traceback[-1]
|
||||
self._write_to_self()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue