Skip to content

Commit 078f2d4

Browse files
add comment
1 parent 6873433 commit 078f2d4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Modules/_asynciomodule.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3768,6 +3768,13 @@ _asyncio_all_tasks_impl(PyObject *module, PyObject *loop)
37683768
}
37693769
int err = 0;
37703770

3771+
// The linked list holds borrowed references to the tasks
3772+
// so before reading from it, all other threads
3773+
// are stopped using stop the world event so that
3774+
// no task could be concurrently deallocated while being
3775+
// added to the list.
3776+
// The state critical section need not to be held as
3777+
// all other threads are paused.
37713778
PyInterpreterState *interp = PyInterpreterState_Get();
37723779
_PyEval_StopTheWorld(interp);
37733780

0 commit comments

Comments
 (0)