Index: Include/pystate.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pystate.h,v retrieving revision 2.19 diff -c -r2.19 pystate.h *** Include/pystate.h 12 Aug 2002 07:21:57 -0000 2.19 --- Include/pystate.h 30 Aug 2002 19:06:58 -0000 *************** *** 22,28 **** PyObject *sysdict; PyObject *builtins; - int checkinterval; #ifdef HAVE_DLOPEN int dlopenflags; #endif --- 22,27 ---- *************** *** 50,56 **** struct _frame *frame; int recursion_depth; - int ticker; int tracing; int use_tracing; --- 49,54 ---- Index: Include/ceval.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/ceval.h,v retrieving revision 2.45 diff -c -r2.45 ceval.h *** Include/ceval.h 12 Aug 2002 07:21:56 -0000 2.45 --- Include/ceval.h 30 Aug 2002 19:06:58 -0000 *************** *** 48,53 **** --- 48,57 ---- PyAPI_FUNC(char *) PyEval_GetFuncName(PyObject *); PyAPI_FUNC(char *) PyEval_GetFuncDesc(PyObject *); + /* this used to be handled on a per-thread basis - now just two globals */ + PyAPI_DATA(volatile int) _Py_Ticker; + PyAPI_DATA(volatile int) _Py_CheckInterval; + /* Interface for threads. A module that plans to do a blocking system call (or something else Index: Python/pystate.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pystate.c,v retrieving revision 2.20 diff -c -r2.20 pystate.c *** Python/pystate.c 19 Jul 2001 12:19:27 -0000 2.20 --- Python/pystate.c 30 Aug 2002 19:06:58 -0000 *************** *** 47,53 **** interp->modules = NULL; interp->sysdict = NULL; interp->builtins = NULL; - interp->checkinterval = 10; interp->tstate_head = NULL; #ifdef HAVE_DLOPEN #ifdef RTLD_NOW --- 47,52 ---- *************** *** 124,130 **** tstate->frame = NULL; tstate->recursion_depth = 0; - tstate->ticker = 0; tstate->tracing = 0; tstate->use_tracing = 0; --- 123,128 ---- Index: Python/ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.332 diff -c -r2.332 ceval.c *** Python/ceval.c 23 Aug 2002 14:11:35 -0000 2.332 --- Python/ceval.c 30 Aug 2002 19:06:59 -0000 *************** *** 395,400 **** --- 395,402 ---- 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,470 **** --- 467,476 ---- 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,676 **** async I/O handler); see Py_AddPendingCall() and Py_MakePendingCalls() above. */ ! if (things_to_do || --tstate->ticker < 0) { ! tstate->ticker = tstate->interp->checkinterval; if (things_to_do) { if (Py_MakePendingCalls() < 0) { why = WHY_EXCEPTION; --- 675,682 ---- async I/O handler); see Py_AddPendingCall() and Py_MakePendingCalls() above. */ ! if (--_Py_Ticker < 0) { ! _Py_Ticker = _Py_CheckInterval; if (things_to_do) { if (Py_MakePendingCalls() < 0) { why = WHY_EXCEPTION; Index: Python/sysmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/sysmodule.c,v retrieving revision 2.108 diff -c -r2.108 sysmodule.c *** Python/sysmodule.c 7 Jul 2002 19:59:50 -0000 2.108 --- Python/sysmodule.c 30 Aug 2002 19:06:59 -0000 *************** *** 352,359 **** static PyObject * sys_setcheckinterval(PyObject *self, PyObject *args) { ! PyThreadState *tstate = PyThreadState_Get(); ! if (!PyArg_ParseTuple(args, "i:setcheckinterval", &tstate->interp->checkinterval)) return NULL; Py_INCREF(Py_None); return Py_None; --- 352,358 ---- static PyObject * sys_setcheckinterval(PyObject *self, PyObject *args) { ! if (!PyArg_ParseTuple(args, "i:setcheckinterval", &_Py_CheckInterval)) return NULL; Py_INCREF(Py_None); return Py_None; *************** *** 792,797 **** --- 791,799 ---- PY_MINOR_VERSION, PY_MICRO_VERSION, s, PY_RELEASE_SERIAL)); + Py_XDECREF(v); + PyDict_SetItemString(sysdict, "api_version", + v = Py_BuildValue("i", PYTHON_API_VERSION)); Py_XDECREF(v); PyDict_SetItemString(sysdict, "copyright", v = PyString_FromString(Py_GetCopyright())); Index: Objects/longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.142 diff -c -r1.142 longobject.c *** Objects/longobject.c 20 Aug 2002 19:00:22 -0000 1.142 --- Objects/longobject.c 30 Aug 2002 19:06:59 -0000 *************** *** 28,38 **** static PyLongObject *divrem1(PyLongObject *, digit, digit *); static PyObject *long_format(PyObject *aa, int base, int addL); - static int ticker; /* XXX Could be shared with ceval? */ - #define SIGCHECK(PyTryBlock) \ ! if (--ticker < 0) { \ ! ticker = 100; \ if (PyErr_CheckSignals()) { PyTryBlock; } \ } --- 28,36 ---- static PyLongObject *divrem1(PyLongObject *, digit, digit *); static PyObject *long_format(PyObject *aa, int base, int addL); #define SIGCHECK(PyTryBlock) \ ! if (--_Py_Ticker < 0) { \ ! _Py_Ticker = _Py_CheckInterval; \ if (PyErr_CheckSignals()) { PyTryBlock; } \ }