Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). #13714

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
59b2d34
ceval -> ceval_r
ericsnowcurrently May 31, 2019
ceceab7
_Py_FinishPendingCalls -> _PyEval_FinishPendingCalls
ericsnowcurrently May 31, 2019
3fbc879
Drop the GIL_REQUEST macro.
ericsnowcurrently May 31, 2019
dedcf7f
Move pending calls from _PyRuntimeState to PyIntepreterState.
ericsnowcurrently Jul 13, 2018
b2c8a7b
Release the pending calls lock *after* updating the eval breaker flag.
ericsnowcurrently Mar 15, 2019
05e2808
Use the internal function.
ericsnowcurrently Sep 14, 2018
d9d70e8
Add a NEWS entry.
ericsnowcurrently Sep 15, 2018
b02a36b
Optionally lock a pending call to a specific thread.
ericsnowcurrently Sep 15, 2018
28a4583
Move core-only field to end of struct.
ericsnowcurrently Feb 1, 2019
b7150c7
Add a TODO.
ericsnowcurrently Feb 18, 2019
87e15fe
Use _Py_AddPendingCall() for releasing shared data.
ericsnowcurrently Sep 14, 2018
07957ba
Check the result of adding the pending call (for releasing XID).
ericsnowcurrently Jan 28, 2019
78c49a0
Make a copy of data-to-be-deleted.
ericsnowcurrently Jan 29, 2019
70ef8f9
Fix the pending-for-other-thread case.
ericsnowcurrently Apr 5, 2019
b392d32
Ignore any lingering pending calls.
ericsnowcurrently Jun 1, 2019
d8ac442
Always use the main interpreter for signals.
ericsnowcurrently Jun 1, 2019
7c0e3cb
Add more information to the TODO in Py_FinalizeEx().
ericsnowcurrently Jun 1, 2019
b8cfc36
Drop a superfluous comment.
ericsnowcurrently Jun 1, 2019
652c7bc
Do not assume that tstate->interp is not NULL.
ericsnowcurrently Jun 1, 2019
fb0fe21
_pending_calls -> _ceval_pending_calls
ericsnowcurrently Jun 1, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move pending calls from _PyRuntimeState to PyIntepreterState.
  • Loading branch information
ericsnowcurrently committed Jun 1, 2019
commit dedcf7f23d9e19544d801624498b3d34cf8158c7
6 changes: 4 additions & 2 deletions Include/internal/pycore_ceval.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ PyAPI_FUNC(void) _PyEval_SignalReceived(
PyAPI_FUNC(int) _PyEval_AddPendingCall(
PyThreadState *tstate,
struct _ceval_runtime_state *,
struct _ceval_interpreter_state *,
int (*func)(void *),
void *arg);
PyAPI_FUNC(void) _PyEval_FinishPendingCalls(_PyRuntimeState *);
PyAPI_FUNC(void) _PyEval_FinishPendingCalls(PyInterpreterState *);
PyAPI_FUNC(void) _PyEval_SignalAsyncExc(
struct _ceval_runtime_state *);
struct _ceval_runtime_state *,
struct _ceval_interpreter_state *);
PyAPI_FUNC(void) _PyEval_ReInitThreads(
_PyRuntimeState *runtime);

Expand Down
11 changes: 10 additions & 1 deletion Include/internal/pycore_pystate.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ extern "C" {
#include "sysmodule.h"

#include "pycore_gil.h" /* _gil_runtime_state */
//#include "pycore_atomic.h"
#include "pycore_pathconfig.h"
#include "pycore_pymem.h"
#include "pycore_warnings.h"
Expand Down Expand Up @@ -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 _pending_calls pending;
};


/* interpreter state */

typedef PyObject* (*_PyFrameEvalFunction)(struct _frame *, int);
Expand Down Expand Up @@ -89,6 +96,8 @@ struct _is {
/* Used in Python/sysmodule.c. */
int check_interval;

struct _ceval_interpreter_state ceval;

/* Used in Modules/_threadmodule.c. */
long num_threads;
/* Support for runtime thread stack size tuning.
Expand Down
8 changes: 6 additions & 2 deletions Modules/signalmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,9 @@ trip_signal(int sig_num)
{
/* Py_AddPendingCall() isn't signal-safe, but we
still use it for this exceptional case. */
_PyEval_AddPendingCall(tstate, &runtime->ceval,
_PyEval_AddPendingCall(tstate,
&runtime->ceval,
&tstate->interp->ceval,
report_wakeup_send_error,
(void *)(intptr_t) last_error);
}
Expand All @@ -318,7 +320,9 @@ trip_signal(int sig_num)
{
/* Py_AddPendingCall() isn't signal-safe, but we
still use it for this exceptional case. */
_PyEval_AddPendingCall(tstate, &runtime->ceval,
_PyEval_AddPendingCall(tstate,
&runtime->ceval,
&tstate->interp->ceval,
report_wakeup_write_error,
(void *)(intptr_t)errno);
}
Expand Down
Loading