diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 1995-01-26 16:36:45 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 1995-01-26 16:36:45 (GMT) |
commit | e8e8ae0f2c5e7e382a9537c7ef2f3c15149be8ff (patch) | |
tree | 4fab1d832a27152ed5716f4311e08215810855f7 /Mac/Modules | |
parent | 9eeb82dde17a8c83446e3d31c3f5b78d25354597 (diff) | |
download | cpython-e8e8ae0f2c5e7e382a9537c7ef2f3c15149be8ff.zip cpython-e8e8ae0f2c5e7e382a9537c7ef2f3c15149be8ff.tar.gz cpython-e8e8ae0f2c5e7e382a9537c7ef2f3c15149be8ff.tar.bz2 |
Added eventhandling in mainloop/busywait routine plus leaving some
cycles for background apps. MacOS has a new method to set the amount
of time for bg apps.
Diffstat (limited to 'Mac/Modules')
-rw-r--r-- | Mac/Modules/macosmodule.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Mac/Modules/macosmodule.c b/Mac/Modules/macosmodule.c index 7fb069c..6c274e8 100644 --- a/Mac/Modules/macosmodule.c +++ b/Mac/Modules/macosmodule.c @@ -107,6 +107,8 @@ MacOS_HighLevelEventProc(EventRecord *e) } } +/* XXXX Need to come here from PyMac_DoYield too... */ + static PyObject * MacOS_SetHighLevelEventHandler(self, args) PyObject *self; @@ -166,6 +168,26 @@ MacOS_AcceptHighLevelEvent(self, args) return res; } +/* +** Set poll frequency and cpu-yield-time +*/ +static PyObject * +MacOS_SetScheduleTimes(PyObject *self, PyObject *args) +{ + long fgi, fgy, bgi, bgy; + + bgi = bgy = -2; + if (!PyArg_ParseTuple(args, "ll|ll", &fgi, &fgy, &bgi, &bgy)) + return NULL; + if ( bgi == -2 ) { + bgi = fgi; + bgy = fgy; + } + PyMac_SetYield(fgi, fgy, bgi, bgy); + Py_INCREF(Py_None); + return Py_None; +} + static PyMethodDef MacOS_Methods[] = { {"AcceptHighLevelEvent", MacOS_AcceptHighLevelEvent, 1}, {"GetCreatorAndType", MacOS_GetCreatorAndType, 1}, @@ -173,6 +195,7 @@ static PyMethodDef MacOS_Methods[] = { #ifdef USE_STDWIN {"SetHighLevelEventHandler", MacOS_SetHighLevelEventHandler, 1}, #endif + {"SetScheduleTimes", MacOS_SetScheduleTimes, 1}, {NULL, NULL} /* Sentinel */ }; |