summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_ceval.h
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-10-31 23:52:28 (GMT)
committerGitHub <noreply@github.com>2018-10-31 23:52:28 (GMT)
commit27e2d1f21975dfb8c0ddcb192fa0f45a51b7977e (patch)
tree351096bf87da77ee8c4b08362e850e9affd18f8f /Include/internal/pycore_ceval.h
parent3a228ab17c2a9cffd1a2f15f30d6209768de20a6 (diff)
downloadcpython-27e2d1f21975dfb8c0ddcb192fa0f45a51b7977e.zip
cpython-27e2d1f21975dfb8c0ddcb192fa0f45a51b7977e.tar.gz
cpython-27e2d1f21975dfb8c0ddcb192fa0f45a51b7977e.tar.bz2
bpo-35081: Add pycore_ prefix to internal header files (GH-10263)
* Rename Include/internal/ header files: * pyatomic.h -> pycore_atomic.h * ceval.h -> pycore_ceval.h * condvar.h -> pycore_condvar.h * context.h -> pycore_context.h * pygetopt.h -> pycore_getopt.h * gil.h -> pycore_gil.h * hamt.h -> pycore_hamt.h * hash.h -> pycore_hash.h * mem.h -> pycore_mem.h * pystate.h -> pycore_state.h * warnings.h -> pycore_warnings.h * PCbuild project, Makefile.pre.in, Modules/Setup: add the Include/internal/ directory to the search paths of header files. * Update includes. For example, replace #include "internal/mem.h" with #include "pycore_mem.h".
Diffstat (limited to 'Include/internal/pycore_ceval.h')
-rw-r--r--Include/internal/pycore_ceval.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/Include/internal/pycore_ceval.h b/Include/internal/pycore_ceval.h
new file mode 100644
index 0000000..ddeeb5c
--- /dev/null
+++ b/Include/internal/pycore_ceval.h
@@ -0,0 +1,52 @@
+#ifndef Py_INTERNAL_CEVAL_H
+#define Py_INTERNAL_CEVAL_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "pycore_atomic.h"
+#include "pythread.h"
+
+struct _pending_calls {
+ unsigned long main_thread;
+ PyThread_type_lock lock;
+ /* Request for running pending calls. */
+ _Py_atomic_int calls_to_do;
+ /* Request for looking at the `async_exc` field of the current
+ thread state.
+ Guarded by the GIL. */
+ int async_exc;
+#define NPENDINGCALLS 32
+ struct {
+ int (*func)(void *);
+ void *arg;
+ } calls[NPENDINGCALLS];
+ int first;
+ int last;
+};
+
+#include "pycore_gil.h"
+
+struct _ceval_runtime_state {
+ int recursion_limit;
+ /* Records whether tracing is on for any thread. Counts the number
+ of threads for which tstate->c_tracefunc is non-NULL, so if the
+ value is 0, we know we don't have to check this thread's
+ c_tracefunc. This speeds up the if statement in
+ PyEval_EvalFrameEx() after fast_next_opcode. */
+ int tracing_possible;
+ /* This single variable consolidates all requests to break out of
+ the fast path in the eval loop. */
+ _Py_atomic_int eval_breaker;
+ /* Request for dropping the GIL */
+ _Py_atomic_int gil_drop_request;
+ struct _pending_calls pending;
+ struct _gil_runtime_state gil;
+};
+
+PyAPI_FUNC(void) _PyEval_Initialize(struct _ceval_runtime_state *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_INTERNAL_CEVAL_H */