Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 25108:3a26e352f0a6 legacy-trunk
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
| author | Skip Montanaro <skip@pobox.com> |
|---|---|
| date | Tue, 03 Sep 2002 20:10:45 +0000 |
| parents | be2868a63ed5 |
| children | 00b6dd414b80 |
line wrap: on
line diff
--- a/Python/ceval.c Tue Sep 03 19:24:24 2002 +0000 +++ b/Python/ceval.c Tue Sep 03 20:10:45 2002 +0000 @@ -395,6 +395,8 @@ 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 @@ 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 @@ 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;
