gh-128002: use per threads tasks linked list in asyncio (#128869)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
Kumar Aditya 2025-02-07 00:21:07 +05:30 committed by GitHub
parent b4ff8b22b3
commit 0d68b14a0d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 156 additions and 58 deletions

View file

@ -227,6 +227,13 @@ struct _is {
PyMutex weakref_locks[NUM_WEAKREF_LIST_LOCKS];
_PyIndexPool tlbc_indices;
#endif
// Per-interpreter list of tasks, any lingering tasks from thread
// states gets added here and removed from the corresponding
// thread state's list.
struct llist_node asyncio_tasks_head;
// `asyncio_tasks_lock` is used when tasks are moved
// from thread's list to interpreter's list.
PyMutex asyncio_tasks_lock;
// Per-interpreter state for the obmalloc allocator. For the main
// interpreter and for all interpreters that don't have their