Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
kumaraditya303 committed Jan 6, 2025
1 parent 6873433 commit ac14219
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Modules/_asynciomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3768,6 +3768,12 @@ _asyncio_all_tasks_impl(PyObject *module, PyObject *loop)
}
int err = 0;

// The linked list holds borowed references to the tasks
// so before reading from it, all other threads
// are stopped using stop the world event so that
// no task could be deallocated while being added to the list.
// The state critical section need not to be held as
// all other threads are paused.
PyInterpreterState *interp = PyInterpreterState_Get();
_PyEval_StopTheWorld(interp);

Expand Down

0 comments on commit ac14219

Please sign in to comment.