summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2002-09-03 20:10:45 (GMT)
committerSkip Montanaro <skip@pobox.com>2002-09-03 20:10:45 (GMT)
commitd581d7792bc31e6249ee6ed20bc2a71f53f0d3bb (patch)
tree5dc5dd8a449fabd541a8f1050d49d7a381b60140 /Python/ceval.c
parentd229b3ae048ca51d9f3865e1e9eaf83ba5a6c424 (diff)
downloadcpython-d581d7792bc31e6249ee6ed20bc2a71f53f0d3bb.zip
cpython-d581d7792bc31e6249ee6ed20bc2a71f53f0d3bb.tar.gz
cpython-d581d7792bc31e6249ee6ed20bc2a71f53f0d3bb.tar.bz2
replace thread state objects' ticker and checkinterval fields with two
globals, _Py_Ticker and _Py_CheckInterval. This also implements Jeremy's shortcut in Py_AddPendingCall that zeroes out _Py_Ticker. This allows the test in the main loop to only test a single value. The gory details are at http://python.org/sf/602191
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 8bd945e..8b3823a0 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -395,6 +395,8 @@ Py_AddPendingCall(int (*func)(void *), void *arg)
pendingcalls[i].func = func;
pendingcalls[i].arg = arg;
pendinglast = j;
+
+ _Py_Ticker = 0;
things_to_do = 1; /* Signal main loop */
busy = 0;
/* XXX End critical section */
@@ -465,6 +467,10 @@ enum why_code {
static enum why_code do_raise(PyObject *, PyObject *, PyObject *);
static int unpack_iterable(PyObject *, int, PyObject **);
+/* for manipulating the thread switch and periodic "stuff" - used to be
+ per thread, now just a pair o' globals */
+int _Py_CheckInterval = 10;
+volatile int _Py_Ticker = 10;
PyObject *
PyEval_EvalCode(PyCodeObject *co, PyObject *globals, PyObject *locals)
@@ -669,8 +675,8 @@ eval_frame(PyFrameObject *f)
async I/O handler); see Py_AddPendingCall() and
Py_MakePendingCalls() above. */
- if (things_to_do || --tstate->ticker < 0) {
- tstate->ticker = tstate->interp->checkinterval;
+ if (--_Py_Ticker < 0) {
+ _Py_Ticker = _Py_CheckInterval;
if (things_to_do) {
if (Py_MakePendingCalls() < 0) {
why = WHY_EXCEPTION;