@@ -11,8 +11,12 @@ extern "C" {
1111#include "pycore_atomic.h"
1212#include "pythread.h"
1313
14+ struct _is ; // See PyInterpreterState in cpython/pystate.h.
15+
16+ PyAPI_FUNC (int ) _Py_AddPendingCall (struct _is * , unsigned long , int (* )(void * ), void * );
17+ PyAPI_FUNC (int ) _Py_MakePendingCalls (struct _is * );
18+
1419struct _pending_calls {
15- unsigned long main_thread ;
1620 PyThread_type_lock lock ;
1721 /* Request for running pending calls. */
1822 _Py_atomic_int calls_to_do ;
@@ -22,13 +26,21 @@ struct _pending_calls {
2226 int async_exc ;
2327#define NPENDINGCALLS 32
2428 struct {
29+ unsigned long thread_id ;
2530 int (* func )(void * );
2631 void * arg ;
2732 } calls [NPENDINGCALLS ];
2833 int first ;
2934 int last ;
3035};
3136
37+ struct _ceval_interpreter_state {
38+ /* This single variable consolidates all requests to break out of
39+ the fast path in the eval loop. */
40+ _Py_atomic_int eval_breaker ;
41+ struct _pending_calls pending ;
42+ };
43+
3244#include "pycore_gil.h"
3345
3446struct _ceval_runtime_state {
@@ -39,12 +51,8 @@ struct _ceval_runtime_state {
3951 c_tracefunc. This speeds up the if statement in
4052 PyEval_EvalFrameEx() after fast_next_opcode. */
4153 int tracing_possible ;
42- /* This single variable consolidates all requests to break out of
43- the fast path in the eval loop. */
44- _Py_atomic_int eval_breaker ;
4554 /* Request for dropping the GIL */
4655 _Py_atomic_int gil_drop_request ;
47- struct _pending_calls pending ;
4856 /* Request for checking signals. */
4957 _Py_atomic_int signals_pending ;
5058 struct _gil_runtime_state gil ;
0 commit comments