diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2019-06-01 21:39:46 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-01 21:39:46 (GMT) |
commit | 6a150bcaeb190d1731b38ab9c7a5d1a352847ddc (patch) | |
tree | 687d690cdcb19d4f30806b628dcdee37a4d61a13 /Include/internal | |
parent | 218e47b61862470477922e9aba1a23fd3dab18ae (diff) | |
download | cpython-6a150bcaeb190d1731b38ab9c7a5d1a352847ddc.zip cpython-6a150bcaeb190d1731b38ab9c7a5d1a352847ddc.tar.gz cpython-6a150bcaeb190d1731b38ab9c7a5d1a352847ddc.tar.bz2 |
bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). (gh-13714)
Diffstat (limited to 'Include/internal')
-rw-r--r-- | Include/internal/pycore_ceval.h | 13 | ||||
-rw-r--r-- | Include/internal/pycore_pystate.h | 12 |
2 files changed, 18 insertions, 7 deletions
diff --git a/Include/internal/pycore_ceval.h b/Include/internal/pycore_ceval.h index 37170ed..d44afdf 100644 --- a/Include/internal/pycore_ceval.h +++ b/Include/internal/pycore_ceval.h @@ -12,19 +12,22 @@ extern "C" { #include "pycore_pystate.h" #include "pythread.h" -PyAPI_FUNC(void) _Py_FinishPendingCalls(_PyRuntimeState *runtime); PyAPI_FUNC(void) _PyEval_Initialize(struct _ceval_runtime_state *); PyAPI_FUNC(void) _PyEval_FiniThreads( - struct _ceval_runtime_state *ceval); + struct _ceval_runtime_state *); PyAPI_FUNC(void) _PyEval_SignalReceived( - struct _ceval_runtime_state *ceval); + struct _ceval_runtime_state *); PyAPI_FUNC(int) _PyEval_AddPendingCall( PyThreadState *tstate, - struct _ceval_runtime_state *ceval, + struct _ceval_runtime_state *, + struct _ceval_interpreter_state *, + unsigned long thread_id, int (*func)(void *), void *arg); +PyAPI_FUNC(void) _PyEval_FinishPendingCalls(PyInterpreterState *); PyAPI_FUNC(void) _PyEval_SignalAsyncExc( - struct _ceval_runtime_state *ceval); + struct _ceval_runtime_state *, + struct _ceval_interpreter_state *); PyAPI_FUNC(void) _PyEval_ReInitThreads( _PyRuntimeState *runtime); diff --git a/Include/internal/pycore_pystate.h b/Include/internal/pycore_pystate.h index 520a74b..aca5533 100644 --- a/Include/internal/pycore_pystate.h +++ b/Include/internal/pycore_pystate.h @@ -25,7 +25,7 @@ struct pyruntimestate; /* ceval state */ -struct _pending_calls { +struct _ceval_pending_calls { int finishing; PyThread_type_lock lock; /* Request for running pending calls. */ @@ -36,6 +36,7 @@ struct _pending_calls { int async_exc; #define NPENDINGCALLS 32 struct { + unsigned long thread_id; int (*func)(void *); void *arg; } calls[NPENDINGCALLS]; @@ -53,15 +54,21 @@ struct _ceval_runtime_state { int tracing_possible; /* This single variable consolidates all requests to break out of the fast path in the eval loop. */ + // XXX This can move to _ceval_interpreter_state once all parts + // from COMPUTE_EVAL_BREAKER have moved under PyInterpreterState. _Py_atomic_int eval_breaker; /* Request for dropping the GIL */ _Py_atomic_int gil_drop_request; - struct _pending_calls pending; /* Request for checking signals. */ _Py_atomic_int signals_pending; struct _gil_runtime_state gil; }; +struct _ceval_interpreter_state { + struct _ceval_pending_calls pending; +}; + + /* interpreter state */ typedef PyObject* (*_PyFrameEvalFunction)(struct _frame *, int); @@ -136,6 +143,7 @@ struct _is { uint64_t tstate_next_unique_id; + struct _ceval_interpreter_state ceval; struct _warnings_runtime_state warnings; PyObject *audit_hooks; |