Skip to content

Commit

Permalink
asyncio: fix thread-safety issue with cached_running_holder
Browse files Browse the repository at this point in the history
Make `cached_running_holder` and `cached_running_holder_tsid` thread local.

Co-authored-by: renpeng <[email protected]>
Co-authored-by: Sam Gross <[email protected]>
  • Loading branch information
3 people authored Nov 20, 2023
1 parent af329af commit 8f9803d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Modules/_asynciomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ static PyObject *asyncio_CancelledError;
static PyObject *context_kwname;
static int module_initialized;

static PyObject *cached_running_holder;
static volatile uint64_t cached_running_holder_tsid;
static Py_DECL_THREAD PyObject *cached_running_holder;
static Py_DECL_THREAD uint64_t cached_running_holder_tsid;

/* Counter for autogenerated Task names */
static uint64_t task_name_counter = 0;
Expand Down

0 comments on commit 8f9803d

Please sign in to comment.