gh-76785: Use Pending Calls When Releasing Cross-Interpreter Data (gh-109556)

This fixes some crashes in the _xxinterpchannels module, due to a race between interpreters.
This commit is contained in:
Eric Snow 2023-09-19 15:01:34 -06:00 committed by GitHub
parent 754519a9f8
commit fd7e08a6f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 99 additions and 68 deletions

View file

@ -11,6 +11,8 @@ extern "C" {
#include "pycore_gil.h" // struct _gil_runtime_state
typedef int (*_Py_pending_call_func)(void *);
struct _pending_calls {
int busy;
PyThread_type_lock lock;
@ -22,7 +24,7 @@ struct _pending_calls {
int async_exc;
#define NPENDINGCALLS 32
struct _pending_call {
int (*func)(void *);
_Py_pending_call_func func;
void *arg;
} calls[NPENDINGCALLS];
int first;