cpython/Lib/asyncio
Kumar Aditya 660f126f87
gh-129898: per-thread current task implementation in asyncio (#129899)
Store the current running task on the thread state, it makes it thread safe for the free-threading build and while improving performance as there is no lock contention, this effectively makes it lock free.
When accessing the current task of the current running loop in current thread, no locking is required and can be acessed without locking.
In the rare case of accessing current task of a loop running in a different thread, the stop the world pauses is used in free-threading builds to stop all other running threads and find the task for the specified loop.

This also makes it easier for external introspection to find the current task, and now it will be always correct.
2025-02-19 16:34:49 +00:00
..
__init__.py GH-91048: Add utils for capturing async call stack for asyncio programs and enable profiling (#124640) 2025-01-22 17:25:29 +01:00
__main__.py gh-127949: deprecate asyncio.set_event_loop (#128218) 2024-12-24 19:24:28 +05:30
base_events.py gh-130145: fix loop.run_forever when loop is already running (#130146) 2025-02-15 15:01:53 +05:30
base_futures.py
base_subprocess.py gh-87744: fix waitpid race while calling send_signal in asyncio (#121126) 2024-07-01 10:17:36 +05:30
base_tasks.py
constants.py
coroutines.py gh-122858: Deprecate asyncio.iscoroutinefunction (#122875) 2024-08-11 16:35:51 +00:00
events.py gh-128308: pass **kwargs to asyncio task_factory (#128768) 2025-01-20 22:23:55 +05:30
exceptions.py
format_helpers.py
futures.py GH-91048: Add utils for capturing async call stack for asyncio programs and enable profiling (#124640) 2025-01-22 17:25:29 +01:00
graph.py GH-91048: Add utils for capturing async call stack for asyncio programs and enable profiling (#124640) 2025-01-22 17:25:29 +01:00
locks.py gh-129403: Fix ValueError messages in asyncio.Barrier and threading.Barrier (#129419) 2025-01-30 11:11:12 +03:00
log.py
mixins.py
proactor_events.py gh-113892: Add a extra check to ProactorEventLoop.sock_connect to ensure that the given socket is in non-blocking mode (#119519) 2024-06-01 09:05:19 -07:00
protocols.py
queues.py gh-96471: Correct documentation for asyncio queue shutdown (#117621) 2024-04-08 14:50:54 +00:00
runners.py Mention loop_factory argument in docstring for asyncio.run() (#128288) 2024-12-27 14:58:35 +01:00
selector_events.py gh-115514: Fix incomplete writes after close while using ssl in asyncio(#128037) 2025-02-02 15:11:25 +00:00
sslproto.py gh-118950: Fix SSLProtocol.connection_lost not being called when OSError is thrown (#118960) 2024-10-24 17:41:16 +00:00
staggered.py gh-129195: use future_add_to_awaited_by/future_discard_from_awaited_by in asyncio.staggered.staggered_race (#129253) 2025-01-26 21:14:16 +05:30
streams.py gh-117722: Fix Stream.readuntil with non-bytes buffer objects (#117723) 2024-04-11 07:41:55 -07:00
subprocess.py
taskgroups.py GH-91048: Add utils for capturing async call stack for asyncio programs and enable profiling (#124640) 2025-01-22 17:25:29 +01:00
tasks.py gh-129898: per-thread current task implementation in asyncio (#129899) 2025-02-19 16:34:49 +00:00
threads.py
timeouts.py gh-128559: Remove typing import from asyncio.timeouts (#128560) 2025-01-06 15:03:27 -08:00
transports.py
trsock.py
unix_events.py gh-127949: deprecate asyncio policy classes (#128216) 2024-12-24 17:30:26 +05:30
windows_events.py gh-127949: deprecate asyncio policy classes (#128216) 2024-12-24 17:30:26 +05:30
windows_utils.py